selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

ferretdb logo

Self-host ferretdb

v2.7.0

MongoDB-compatible document database on PostgreSQL

ReleaseOpen SourceApache-2.0
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
Updated12 months ago
LanguageGo
Setup difficultyModerate
Stars
11 116
Ports
27017 (MongoDB wire protocol for clients and drivers), 8088 (HTTP debug handler: metrics, pprof, probes)
Requires
PostgreSQL with DocumentDB extension
Docker
ghcr.io/ferretdb/ferretdb

What 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

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

FerretDB

Tip

Looking for FerretDB v1? It is there.

Go Reference

Go codecov

How to install ferretdb

Install ferretdb with Docker

Environment variables
POSTGRES_USER, POSTGRES_PASSWORD
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

Evaluation image bundles FerretDB, PostgreSQL with DocumentDB extension and MongoDB Shell; data preserved in ./data.

How to configure ferretdb

  • FERRETDB_POSTGRESQL_URLpostgres://127.0.0.1:5432/postgresPostgreSQL connection URL
  • FERRETDB_POSTGRESQL_URL_FILEPath to a file containing the PostgreSQL connection URL. If non-empty, this overrides --postgresql-url.
  • FERRETDB_LISTEN_ADDR127.0.0.1:27017 (:27017 for Docker)Listen TCP address for MongoDB protocol (set to empty value or - to disable)
  • FERRETDB_LISTEN_UNIXListen Unix domain socket path for MongoDB protocol (set to empty value or - to disable)
  • FERRETDB_LISTEN_TLSListen TLS address for MongoDB protocol (see here) (set to empty value or - to disable)

ferretdb releases & version history

@ Every self-hosted release, weekly

One Monday email with the week's stable releases across the directory.

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…