FerretDB
An open-source database proxy that translates MongoDB wire-protocol requests to a supported PostgreSQL-based backend.
Why consider FerretDB?
FerretDB is an open-source proxy that translates MongoDB wire protocol queries to SQL using PostgreSQL as the backend engine. It enables teams to run MongoDB workloads on open-source relational databases without changing their application drivers.
Learn FerretDB by building
Practical setup notes, real use cases, and copy-ready examples in one focused guide.
In this guide3 sections
FerretDB: Open-Source MongoDB Alternative on PostgreSQL
Modern document-oriented applications often require flexible schema management without the vendor lock-in or licensing restrictions imposed by proprietary document stores. FerretDB is an open-source alternative to MongoDB that operates as a proxy converting wire protocol queries to SQL, allowing developers to retain familiar document database APIs while persisting data into relational storage backends. According to the project's official README, this proxy architecture bridges existing application client drivers with reliable relational database engines.
Developers who adopted document databases early on valued their rapid development speed and driver availability. The project was created after MongoDB changed its licensing model to the Server Side Public License (SSPL), which rendered legacy tooling problematic for commercial and open-source distributions. As detailed in the project README, FerretDB provides a community-driven drop-in option that restores open licensing without requiring teams to rewrite their application code.
Architectural Overview and Database Engines
At a technical level, FerretDB translates MongoDB wire protocol queries to SQL with PostgreSQL and the DocumentDB extension as the underlying engine. This design, documented across the FerretDB documentation, enables applications using standard MongoDB drivers (such as mongosh or official language SDKs) to communicate directly with PostgreSQL without needing bespoke query rewriting layers or complex data migration bridges.
The internal architecture divides duties cleanly between networking and storage abstraction. The codebase organizes command handling and wire protocol server implementations within dedicated internal subpackages, ensuring that query parsing routines for operations like find or aggregate remain decoupled from wire protocol transport protocols. Full architectural details are documented in the project's contributing documentation.
Setting Up Local Development and Building Binaries
When setting up a local development environment, contributors run backend databases inside containerized environments. The supported development setup runs PostgreSQL and other dependencies inside Docker containers while executing FerretDB on the host, ensuring fast compile-test feedback loops during active iteration as outlined in the contributing guide.
System requirements are straightforward for developers working on the source code. Developers building the project require Go 1.25 or later installed on their host system, alongside Git and Docker tools as specified in the official contributing guide.
To begin working with the source code, fork the official GitHub repository and clone your fork locally, establishing the upstream repository remote and fetching all tags as described in the official contributing guide:
git clone git@github.com:<YOUR_GITHUB_USERNAME>/FerretDB.gitcd FerretDBgit remote add upstream https://github.com/FerretDB/FerretDB.gitgit fetch --all --tagsOnce development and testing steps conclude, creating deployable assets is handled through automated build scripts. Production release binaries can be compiled with the task build-production command and saved to the binary output directory, allowing teams to produce optimized executables directly from source as described in the contributing instructions.
Release Lifecycle and Security Maintenance
Software reliability and ongoing vulnerability management follow clearly defined versioning cycles. The FerretDB project officially maintains security and maintenance support for the two latest minor versions, ensuring that active deployments receive timely security fixes and patches as documented in the project's security policy.
Production deployments should track tagged versions from the official GitHub releases page to ensure compatibility with backend storage extensions and driver capabilities. The project distributes its source code under the terms of the Apache-2.0 license as verified in the official project license.
Related tools
More options with a similar category or technology profile.
diskus
Minimal, fast alternative to du -sh written in Rust using multi-threaded directory traversal.
peco
Simplistic interactive filtering tool for Unix pipelines, process lists, and file trees.
Dapr CLI
Command-line tool for managing Dapr distributed application runtime environments and sidecars.
Freeze
Generate beautiful image screenshots and SVGs of code snippets and terminal outputs.