Repo of the Day
FerretDB/FerretDB
Published: Apr 21, 2023
Open repository ↗A truly Open Source MongoDB alternative
Summary
FerretDB is an open-source proxy that translates MongoDB 5.0+ wire protocol queries into SQL, storing data in PostgreSQL with the DocumentDB extension. It positions itself as a drop-in replacement for MongoDB for teams that want a document database without MongoDB's SSPL license terms.
What it is useful for
FerretDB fits situations where an application is already written against MongoDB drivers and tools but the team wants to avoid the SSPL license or run on PostgreSQL infrastructure. Because it speaks the MongoDB wire protocol, existing drivers and clients can connect without code changes. It is also relevant for engineers who want document-style data while keeping their data in PostgreSQL for backup, replication, or operational reasons. A Go library package, referenced from the README, lets developers embed FerretDB directly into a Go application.
How engineers can use it
The README documents a quick evaluation setup using a single Docker image that bundles FerretDB, PostgreSQL with the DocumentDB extension, and mongosh:
docker run -d --rm --name ferretdb -p 27017:27017 \
-e POSTGRES_USER=<username> \
-e POSTGRES_PASSWORD=<password> \
ghcr.io/ferretdb/ferretdb-eval:2
After it starts, applications connect with a standard MongoDB URI such as mongodb://<username>:<password>@127.0.0.1:27017/. For ad-hoc queries, docker exec -it ferretdb mongosh opens a shell against the same instance, and docker exec -it ferretdb psql -U <username> postgres connects to the underlying PostgreSQL. The maintainers also point to binary packages for several Linux distributions and a Go library on pkg.go.dev for embedding the server in a Go process. The README advises against building from source because of generated files and build tags.
A few caveats from the README are worth noting: the eval image keeps all data inside the container and loses it on shutdown, so it is not for production use. The project also acknowledges that it is not a full MongoDB replacement and maintains a list of known differences and supported commands that should be reviewed before adoption.