Skip to content

Embedded PostgreSQL for local development

Accepted.

2026-08-14.

The platform’s system of record is PostgreSQL, and in production its queue is SQS and its coordination uses Redis. A developer who wants to try the platform, or build an application against it, should not first install a database, run Docker and provision a queue. The same applies to the platform’s own integration tests, which need a real database because behaviour depends on row locks, constraints and SQL features that a fake would not reproduce.

The platform also avoids database extensions (see No Postgres extensions), which makes a vanilla server enough.

  • fcdev, the local monolith, starts all subsystems in one process against an embedded PostgreSQL with no Docker, no SQS and no Redis. The dev queue is Postgres-backed.
  • The embedded server is a bundled vanilla PostgreSQL started through a library, which downloads a platform-specific binary bundle on first run and caches it per version. The first start needs network access; later starts do not.
  • The major version is pinned explicitly (currently 18) rather than inherited from the library’s default. A Postgres major upgrade is not in place, so a library bump must never silently change the major. If the data directory was created by another major, start-up fails with an actionable message, and fcdev db upgrade performs the on-disk transition.
  • The cluster lives in the user’s data directory and the default port is 15432, set with FC_EMBEDDED_DB_PORT or a flag. make db-reset wipes it.
  • The integration tests use the same technology: a throw-away cluster in a temporary directory on a free port, migrated once per test package, with a pool large enough that parallel tests cannot starve each other.
  • The embedded build is vanilla: standard contrib extensions, but not PostGIS. An application that needs PostGIS can transplant a matching build or run its own database (see the PostGIS guide).

Good:

  • One command from a clean machine to a running platform.
  • Integration tests run against the real engine, in CI and locally, without service containers.
  • Local and production behaviour agree on the database.

Bad:

  • The first run downloads a bundle, and offline first starts fail.
  • A pinned major means upgrades are deliberate and need fcdev db upgrade.
  • It is not production-grade: no replication, no tuning, and extensions beyond the vanilla set need manual work.
  • Local runs do not exercise SQS or Redis paths.
Alternative Why not
Docker Compose Requires Docker and slows the start.
A developer-installed PostgreSQL Version and configuration differ per machine.
SQLite or an in-memory fake Different SQL and locking behaviour; hides bugs.
Inherit the library’s default major A library bump could break existing data directories.