FerretDB is a free, open source databases project written in Go and released under Apache-2.0. It has 11,070 GitHub stars, 488 forks and 448 open issues, and was last pushed 3 months ago. On this registry it ranks #72 of 143 tracked projects in Databases, with 5 head-to-head comparisons available.

What is FerretDB?

FerretDB is an open-source, Apache-2.0 licensed proxy written in Go that converts MongoDB 5.0+ wire protocol queries into SQL and stores the data in PostgreSQL with the DocumentDB extension, giving developers a drop-in MongoDB-compatible document database without MongoDB's SSPL licence.

What it is

FerretDB is a database proxy. Any application using any MongoDB driver speaks the MongoDB protocol with BSON to FerretDB, and FerretDB translates those queries into SQL over the PostgreSQL protocol, which PostgreSQL with the DocumentDB extension then executes as the storage engine. It is written in Go and released under the Apache-2.0 licence. The project explicitly positions itself as compatible with MongoDB drivers and popular MongoDB tools, and as a drop-in replacement for MongoDB 5.0+ in many cases.

The concrete problem it solves is licensing. MongoDB changed its licence to SSPL, which made it unusable for many open-source and early-stage commercial projects. Most MongoDB users do not need the advanced features MongoDB offers, but they do need an easy-to-use open-source document database. FerretDB fills that gap by keeping the MongoDB wire protocol and driver ecosystem intact while replacing the underlying engine with PostgreSQL and the DocumentDB extension, so existing applications can keep their drivers and tools and change only the connection target.

Key capabilities

  • Converts MongoDB 5.0+ wire protocol queries to SQL and stores data in PostgreSQL with the DocumentDB extension.
  • Functions as a drop-in replacement for MongoDB 5.0+ in many cases, with compatibility and supported commands documented at docs.ferretdb.io/migration/compatibility.
  • Accepts connections from any MongoDB client using the URI mongodb://user:[email protected]:27017/.
  • Ships an evaluation Docker image, ghcr.io/ferretdb/ferretdb-eval:2, that pre-packages FerretDB, PostgreSQL with the DocumentDB extension, and MongoDB Shell.
  • Provides a Go library package, github.com/ferretdb/ferretdb/v2/ferretdb, that embeds FerretDB into an application.
  • Distributes binaries and packages for various Linux distributions.
  • Maintains a public roadmap at github.com/orgs/FerretDB/projects/2/views/1 and a v1 branch at main-v1.

Who uses it and how

  • Teams with existing MongoDB applications that need to stay under a permissive Apache-2.0 licence can swap the connection target and keep their drivers and tools.
  • Open-source and early-stage commercial projects that found MongoDB's SSPL licence unusable are the intended audience.
  • Developers running the evaluation container connect with mongosh, either locally or through docker exec -it ferretdb mongosh.
  • Database administrators inspect the underlying data by running docker exec -it ferretdb psql -U postgres.
  • Application authors who need an embedded document store can import the Go package rather than deploy a separate server.

Getting started

The quickstart runs docker run -d --rm --name ferretdb -p 27017:27017 with POSTGRES_USER and POSTGRES_PASSWORD set, using the image ghcr.io/ferretdb/ferretdb-eval:2. That image is for evaluation only because it keeps all data inside the container and loses it on shutdown; the installation guides at docs.ferretdb.io/installation describe production setups, and the README advises users not to build FerretDB themselves.

How it compares

FerretDB sits between MongoDB and PostgreSQL rather than competing with PostgreSQL. It presents the MongoDB 5.0+ wire protocol to any MongoDB driver while persisting data in PostgreSQL with the DocumentDB extension, so it substitutes for MongoDB in projects where the SSPL licence is a blocker, while PostgreSQL remains the engine FerretDB relies on rather than an alternative to it.

When to use it — and when not to

FerretDB suits teams that need a MongoDB-compatible document store under a permissive Apache-2.0 licence and are prepared to operate PostgreSQL with the DocumentDB extension alongside it. The quickstart ferretdb-eval image is explicitly unsuitable for production because all data lives in the container and disappears on shutdown, so production requires separately managed PostgreSQL storage. Compatibility is a work in progress with known differences from MongoDB documented, and the README advises against building from source, so anyone depending on exact MongoDB behaviour should review the compatibility list and public roadmap before committing.

project readme (upstream, from github) — read inline

FerretDB

[!TIP] Looking for FerretDB v1? It is there.

Go Reference

Go codecov

Security Packages Docs

FerretDB is an open-source alternative to MongoDB. It is a proxy that converts MongoDB 5.0+ wire protocol queries to SQL and uses PostgreSQL with DocumentDB extension as a database engine.

flowchart LR
  A["Any application<br>Any MongoDB driver"]
  F{{FerretDB}}
  P[(PostgreSQL<br>DocumentDB extension)]

  A -- "MongoDB protocol<br>BSON" --> F
  F -- "PostgreSQL protocol<br>SQL" --> P

Why do we need FerretDB?

MongoDB was originally an eye-opening technology for many of us developers, empowering us to build applications faster than using relational databases. In its early days, its ease-to-use and well-documented drivers made MongoDB one of the simplest database solutions available. However, as time passed, MongoDB abandoned its open-source roots; changing the license to SSPL - making it unusable for many open-source and early-stage commercial projects.

Most MongoDB users do not require any advanced features offered by MongoDB; however, they need an easy-to-use open-source document database solution. Recognizing this, FerretDB is here to fill that gap.

Scope and current state

FerretDB is compatible with MongoDB drivers and popular MongoDB tools. It functions as a drop-in replacement for MongoDB 5.0+ in many cases. Features are constantly being added to further increase compatibility and performance.

We welcome all contributors. See our public roadmap, lists of known differences and supported commands, and contributing guidelines.

Quickstart

Run this command to start FerretDB with PostgreSQL, make sure to update and:

docker run -d --rm --name ferretdb -p 27017:27017 \
  -e POSTGRES_USER=<username> \
  -e POSTGRES_PASSWORD=<password> \
  ghcr.io/ferretdb/ferretdb-eval:2

This command will start a container with FerretDB, pre-packaged PostgreSQL with DocumentDB extension, and MongoDB Shell for quick testing and experiments. However, it is unsuitable for production use cases because it keeps all data inside and loses it on shutdown. See our installation guides for instructions that don't have those problems.

With that container running, you can:

  • Connect to it with any MongoDB client application using the MongoDB URI mongodb://:@127.0.0.1:27017/.
  • Connect to it using the MongoDB Shell by just running mongosh. If you don't have it installed locally, you can run docker exec -it ferretdb mongosh.
  • For PostgreSQL, connect to it by running docker exec -it ferretdb psql -U postgres.

You can stop the container with docker stop ferretdb.

We also provide binaries and packages for various Linux distributions. as well as Go library package that embeds FerretDB into your application. See our documentation for more details.

Building and packaging

[!NOTE] We advise users not to build FerretDB themselves. Instead, use binaries, Docker images, or packages provided by us.

FerretDB could be built as any other Go program, but a few generated files and build tags could affect it. See there for more details.

Managed FerretDB at cloud providers

Community

If you want to contact FerretDB Inc., please use this form.

Frequently asked questions

Is FerretDB free to use?

FerretDB is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does FerretDB do?

A truly Open Source MongoDB alternative

What is FerretDB written in?

FerretDB is primarily written in Go. Its source is publicly available at https://github.com/FerretDB/FerretDB, and it has 11,070 GitHub stars.