Deploy FerretDB

FerretDB 2.7 MongoDB-compatible database on Postgres with DocumentDB.

Deploy FerretDB

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.0 with a volume
  • A Railway TCP proxy for external MongoDB clients

Deployment Dependencies

Implementation Details

ServiceImageNetworkingStorage
ferretdbferretdb/ferretdb:2.7.0private 27017; TCP proxy to 27017none
documentdbferretdb/postgres-documentdb:17-0.107.0-ferretdb-2.7.0private onlyvolume 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})'
VariableServiceDefaultPurpose
POSTGRES_USER / POSTGRES_PASSWORDdocumentdbferret / generatedDatabase and MongoDB credentials
FERRETDB_POSTGRESQL_URLferretdbreferencesBackend 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

More templates in this category

View Template
Garage S3 Storage
Ultra-light S3 server: fast, open-source, plug-and-play.

PROJETOS
8
View Template
Redis
Self Host Latest Redis with Railway

8
View Template
EasyImg
Simple self-hostable Nuxt.js personal image hosting system.

Muhammad Bilal
0