Self-host ferretdb
v2.7.0MongoDB-compatible document database on PostgreSQL
docker run -d --name ferretdb -p 27017:27017 -e POSTGRES_USER=<username> -e POSTGRES_PASSWORD=<password> -v ./data:/var/lib/postgresql/data ghcr.io/ferretdb/ferretdb-eval:2- Stars
- 11 116
- Ports
- 27017 (MongoDB wire protocol for clients and drivers), 8088 (HTTP debug handler: metrics, pprof, probes)
- Requires
- PostgreSQL with DocumentDB extension
ghcr.io/ferretdb/ferretdbWhat is ferretdb?
FerretDB is an open-source, MongoDB-compatible document database that lets applications keep using their existing MongoDB drivers and tools while the data lives in PostgreSQL. It works as a protocol proxy: incoming MongoDB 5.0+ BSON wire-protocol requests are translated into SQL and executed against PostgreSQL with the DocumentDB extension, either as a separate service or bundled in the evaluation image. Document CRUD, aggregations and indexes are supported, along with TLS-encrypted connections, authentication delegated to PostgreSQL (SCRAM-SHA-256 for clients), an optional HTTP Data API for driverless access and an MCP server. Observability is built in: structured logging in console/text/json/mongo formats, Prometheus metrics at /debug/metrics, OpenTelemetry trace export, and liveness and readiness probes. Special operation modes (proxy, diff-normal, diff-proxy) forward requests to a real MongoDB and log the differences, which helps during migration. Self-hosting is documented for Docker and Docker Compose, Kubernetes, DEB and RPM packages, a systemd unit, Windows, macOS and as an embedded Go library. Compatibility is still partial: the project publishes a list of unsupported commands and known behavioural differences, and basic anonymous usage telemetry (sent to FerretDB Beacon) is configurable and can be disabled.
ferretdb alternatives
Percona Server for MongoDBSelf-hosted, source-available MongoDB drop-in replacement adding enterprise features like LDAP auth, encryption, hot backup, and auditing without vendor lock-in.ComparePercona Server for MongoDB with ferretdb
firebolt-coreA free, self-hosted analytical database with PostgreSQL SQL, Iceberg support, and distributed query execution scaling from laptop to enterprise clusters.Comparefirebolt-core with ferretdb
ferdium-serverOpen-source, self-hostable backend for Ferdium messaging aggregator to manage accounts, workspaces, and custom recipes on your infrastructure.Compareferdium-server with ferretdb
DumboDBDumboDB is a self-hosted, open-source document database with MongoDB 8.0 wire protocol and Git-style version control for data. Runs via Docker or binary.CompareDumboDB with ferretdb
PgDogSelf-hosted, open-source PostgreSQL proxy written in Rust: transaction-mode connection pooling, read/write load balancing with health checks, and automatic sharding.ComparePgDog with ferretdb
mongoSelf-hosted MongoDB Community Server: the source-available document database with replica sets, sharding, ACID transactions, and built-in search.Comparemongo with ferretdb
LibreDB StudioSelf-hosted, open-source SQL IDE covering 41 database engines in one browser tab, with OIDC SSO, RBAC, query auditing and an AI query agent — MIT licensed.CompareLibreDB Studio with ferretdb
PeerDBSelf-hosted, open-source (AGPL-3.0) ETL tool streaming Postgres to ClickHouse and other warehouses via CDC, with a web UI and a Postgres-compatible SQL interface.ComparePeerDB with ferretdb
All self-hosted alternatives to MongoDB → All self-hosted alternatives to MongoDB Atlas Data API →
Should you self-host ferretdb?
ferretdb scores 67/100 on selfhost.directory (how scoring works) and ranks #2 of 2 in Document Database. It has 11 116 GitHub stars, +26 in the last 30 days.
It shipped 1 stable release in the past year. The latest, v2.7.0, came out on 10 November 2025.
Setup is moderate: expect some configuration beyond a single command. An official Docker image is available. It is Apache-2.0-licensed and written mostly in Go.
Its closest alternative on selfhost.directory is SurrealDB (77/100, 33 302 stars). It scores higher overall, so compare the two before you pick. See ferretdb vs SurrealDB side by side.
Features
- Aggregation pipelines
- Authentication via PostgreSQL
- Diff and proxy operation modes
- Document CRUD operations
- Health probes
- HTTP Data APIDisabled by default; enable with FERRETDB_LISTEN_DATA_API_ADDR or --listen-data-api-addr.
- Index management
- MCP ServerEnable with FERRETDB_LISTEN_MCP_ADDR or --listen-mcp-addr.
- MongoDB wire protocol compatibility
- OpenTelemetry tracingTrace format not stable yet.
- Prometheus MetricsMetric set not stable yet.
- SCRAM-SHA-256 authenticationOnly mechanism supported on the client at the moment.
- Structured Logging
- TLS connections
- Transactions
ferretdb README
Tip
Looking for FerretDB v1? It is there.
More in Document Database
KintoOpen-source, self-hosted JSON document store behind an HTTP API with fine-grained permissions and device synchronisation; used at Mozilla for Firefox settings sync.
mongoSelf-hosted MongoDB Community Server: the source-available document database with replica sets, sharding, ACID transactions, and built-in search.
Apache CouchDBSelf-hosted, open-source Apache CouchDB is a document database with an HTTP/JSON API, bi-directional replication for offline-first sync, and multi-server clustering.
arangodbSelf-hosted multi-model database for documents, graphs and key-values, queried in one AQL language; the open-source Community edition is free for non-commercial use.
ArcadeDBOpen-source, self-hosted multi-model database: one ACID engine for graph, document, key-value, vector, full-text and time-series data, queried in SQL, Cypher or Gremlin.
CouchDBSeamless multi-primary syncing database with an intuitive HTTP/JSON API, designed for reliability
0 comments