
Deploy FerretDB
FerretDB 2.7 MongoDB-compatible database on Postgres with DocumentDB.
ferretdb
Just deployed
Just deployed
/var/lib/postgresql/data
Deploy and Host FerretDB on Railway
FerretDB is an open-source, MongoDB-compatible database that stores documents in PostgreSQL through Microsoft's DocumentDB extension. Existing MongoDB drivers, tools and ODMs such as Mongoose connect unchanged, while the data lives in Postgres under an Apache 2.0 license, making it a truly open replacement for MongoDB.
About Hosting FerretDB
This template deploys FerretDB v2.7.0 with its matching PostgreSQL 17 image that includes the DocumentDB extension, stored on a Railway volume. MongoDB clients authenticate with the Postgres username and generated password over SCRAM. Services on Railway connect over the private network on port 27017, and external clients use the Railway TCP proxy. Telemetry is off. Both images come from Docker Hub; the same database image from GHCR stalled during deployment on Railway in testing. Storage grows with data; watch the volume on the Hobby plan. Back up the database volume regularly.
Common Use Cases
- Running MongoDB applications on an open-source, Postgres-backed database
- Moving off MongoDB SSPL licensing while keeping drivers and queries
- Document storage with Postgres backups and tooling
Dependencies for FerretDB Hosting
ferretdb/ferretdb:2.7.0(official image)ferretdb/postgres-documentdb:17-0.107.0-ferretdb-2.7.0with a volume- A Railway TCP proxy for external MongoDB clients
Deployment Dependencies
Implementation Details
| Service | Image | Networking | Storage |
|---|---|---|---|
| ferretdb | ferretdb/ferretdb:2.7.0 | private 27017; TCP proxy to 27017 | none |
| documentdb | ferretdb/postgres-documentdb:17-0.107.0-ferretdb-2.7.0 | private only | volume at /var/lib/postgresql/data |
MONGODB_URL=${{ferretdb.MONGODB_URL}} # inside Railway
MONGODB_PUBLIC_URL=${{ferretdb.MONGODB_PUBLIC_URL}} # external, via TCP proxy
mongosh "$MONGODB_PUBLIC_URL" --eval 'db.orders.insertOne({sku: "a1", qty: 2})'
| Variable | Service | Default | Purpose |
|---|---|---|---|
POSTGRES_USER / POSTGRES_PASSWORD | documentdb | ferret / generated | Database and MongoDB credentials |
FERRETDB_POSTGRESQL_URL | ferretdb | references | Backend connection |
Notes:
- The TCP proxy carries MongoDB traffic without TLS; use the private network for production apps where possible.
- Some MongoDB features are not supported yet; check the compatibility page before migrating.
This is a community-maintained deployment package and does not imply affiliation with or endorsement by the FerretDB project or its maintainers.
Why Deploy FerretDB on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying FerretDB on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content