# FerretDB + Postgres

Mongo-compatible documents on Postgres. FerretDB is Apache-2.0. MongoDB Community is SSPL — not OSI open source — so it is not the path.

**Replaces:** MongoDB Atlas

**Tier:** Medium

## Problem

MongoDB Atlas is a hosted cluster with a meter. MongoDB Community Server is SSPL, which OSI does not list as open source. FerretDB is Apache-2.0: it speaks the MongoDB 5.0+ wire protocol and stores data in PostgreSQL (DocumentDB extension). If you do not need the Mongo protocol, /stacks/go-pocketbase-htmx is the simpler app database.

## Stack

- [FerretDB](https://www.ferretdb.com) — Apache-2.0 MongoDB-compatible proxy on Postgres
- [PocketBase](https://pocketbase.io/) — Embedded SQLite app database if you do not need Mongo

## Estimated SaaS cost saved

| You stop paying | Typical / year | Self-host instead |
|---|---:|---|
| MongoDB Atlas dedicated (small team) | $2,400 | FerretDB + Postgres |

**About $2,400 / year** on a small team, before you count lock-in.

## Deploy on Railway

Placeholder: FerretDB + the project's Postgres/DocumentDB image, data on a volume. Apps that do not need Mongo talk should use /stacks/go-pocketbase-htmx instead.

[Start on Railway](https://c17.io/go/railway/ferretdb-mongo?from=%2Fstacks%2Fferretdb-mongo.md)

[Go + PocketBase if you can skip the Mongo protocol](https://c17.io/stacks/go-pocketbase-htmx)

## AGENT_PROMPT

```
Replace MongoDB Atlas with FerretDB + PostgreSQL.

Do not install MongoDB Community and call it open source — it is SSPL.
- Follow FerretDB's production compose (FerretDB + the DocumentDB Postgres image). Persist Postgres on a volume.
- Point one existing Mongo driver at the new URI. Confirm a find and an insert.
- If the app can drop Mongo entirely, use /stacks/go-pocketbase-htmx instead.
- Write AGENT_PROMPT.md.
```

## FAQ

### Why not self-host MongoDB?

MongoDB Community is SSPL. That is not an OSI open-source license. FerretDB is Apache-2.0 on Postgres. Compatibility is good for many apps — test your queries before you cut over.

### Why PocketBase then?

If you do not need a Mongo driver, skip the proxy. PocketBase is the c17 app database. This page is for teams stuck on a Mongo client.

Source: https://c17.io/stacks/ferretdb-mongo
