Skip to main content
50% off all plans, limited time. Starting at $2.48/mo
FerretDB

FerretDB

FerretDB is a MongoDB-compatible database backed by PostgreSQL or SQLite. Open-source replacement for MongoDB Atlas with no SSPL licensing surprises. Apache 2.0 licensed, runs MongoDB drivers unchanged, and inherits Postgres durability and tooling.

At a glance

11k

GitHub stars

47

Page views

103

Active installs

License Apache-2.0 Version 2.7.0 OS Ubuntu Server 24.04 LTS Min RAM 1 GB IP IPV4,IPV6

Active installs is sample data (staging preview); real metric wires in before launch.

Architecture

Client
 ↓
 Port 27017 (MongoDB protocol)
 ↓
 FerretDB container
 ↓
 PostgreSQL container (internal Docker network)
 ↓
 Persistent storage directory

FerretDB translates MongoDB wire protocol requests into PostgreSQL queries internally.

PostgreSQL is not publicly exposed.

Ports

  • 27017/tcp → Public MongoDB-compatible endpoint
  • 5432/tcp → Internal PostgreSQL (not exposed externally)

Access

Credentials reference: /root/ferretdb/.env

Install client if needed:

apt install -y mongodb-mongosh

Connect with authentication:

mongosh "mongodb://<USERNAME>:<PASSWORD>@<SERVER_IP>:27017/<DATABASE>?authSource=postgres"

Important Files & Directories

  • Install directory: /root/ferretdb
  • Compose file: /root/ferretdb/docker-compose.yml
  • Environment file: /root/ferretdb/.env
  • PostgreSQL data directory: /root/ferretdb/data

Service Management

Check status:

docker ps

View logs:

docker compose -f /root/ferretdb/docker-compose.yml logs -f

Restart services:

docker compose -f /root/ferretdb/docker-compose.yml restart

Common MongoDB Commands

List databases:

show dbs

Switch database:

use postgres

List collections:

show collections

View documents:

db.collection_name.find()

Insert document:

db.collection_name.insertOne({ name: "example" })

Exit shell:

exit

Bind FerretDB to Localhost for Security

Authentication is enabled, but exposed database services are still a risk.

Edit: /root/ferretdb/.env

Change HOST=0.0.0.0 to HOST=127.0.0.1

Then apply changes:

docker compose -f /root/ferretdb/docker-compose.yml up -d

Now the service is not accessible externally.

Access using SSH port forwarding.

From your local machine:

ssh -L 27017:localhost:27017 root@<SERVER_IP>

Then connect locally:

mongosh "mongodb://<USERNAME>:<PASSWORD>@localhost:27017/<DATABASE>?authSource=postgres

More in Database Tools

Related apps.

Deploy FerretDB now. From $2.48/mo.