One database as the system of record
PostgreSQL is an open-source relational database developed by its community, with roots in the POSTGRES project at the University of California, Berkeley. In Endora Commerce it is not one option among several engines: it is the only database the platform runs on.
Every part of the platform that needs a system of record (the pricing engine, the order lifecycle, quote requests, the organization hierarchy, the audit log) reads and writes to the same database. There is no separate proprietary store for any of it. The backend reaches it through Fastify with MikroORM, and Zod contracts type-check both sides of every request.
The rest of the stack holds only derived or working data:
| System | What it holds | What happens if it is lost |
|---|---|---|
| PostgreSQL | All source-of-truth data | The platform is down and needs a restore from backup |
| Redis | Cache and job queues | No source data is lost, queued jobs are delayed |
| Meilisearch | The catalog search index | The product listing is served from PostgreSQL, and each channel’s index can be rebuilt from the database with one command |
In practice, this means your backup and recovery plan is mostly about this one database.
What you need on the database side
- Version. PostgreSQL 16.x is required. The development environment and the reference production Compose file use the same version. Under the PostgreSQL versioning policy, each major version is supported for five years, and version 16 until November 2028.
- Connection. The backend gets the database address in a single environment variable,
DATABASE_URL. It contains the password, so treat it as a secret. You can run the database yourself, hand it to a partner, or use a managed PostgreSQL service: only the connection string changes. - The pg_trgm extension. One of the product feeds module’s migrations creates the
pg_trgmextension, used for typeahead when searching categories in a taxonomy. It is a standard PostgreSQL module marked as trusted, so a user with theCREATEprivilege on the database can install it. With a managed database, check before migrating that the provider makes this extension available. - Network. In the reference deployment the database runs on the internal container network and is not exposed externally. Only the backend processes connect to it.
Migrations and upgrades
The schema is not created by hand. Each module has its own migration files, and the platform runs them module by module, in an order derived from the dependencies between modules. The whole run happens in one transaction: either all migrations go through or none do.
In the reference deployment the start order is fixed: the database reports healthy, a separate one-off step runs the migrations, another installs the modules, and only then do the API and the storefront start.
Migrations do not run backwards. That is why the upgrade documentation tells you to back up the database before moving to a new version, and to stop the API together with its queue consumers so that nothing is serving requests while the schema changes.
Backups and monitoring
Because it is stock PostgreSQL rather than a proprietary fork, standard backup tooling, monitoring, replication and hosting options all apply without modification. The deployment documentation recommends a minimum worth having from day one:
- A scheduled pg_dump run from cron and stored off the server the database runs on.
- A backup of the files alongside the database. Product images and invoice PDFs are not kept in PostgreSQL but in file storage: on the server’s disk, or in Amazon S3 or Google Cloud Storage. A restored database without the files is a catalog of broken images.
- A trial restore of both backups into a separate environment before go-live.
For monitoring there is the GET /api/v1/_health endpoint. It runs a simple query against the database, checks Redis and Meilisearch as well, and responds with a 503 when any of the dependencies is unreachable. You can point a load balancer or external monitoring at it.
What to keep in mind with direct database access
Data isolation between buyer organizations is enforced in the backend’s data access layer, not by a separate database per customer. A database account connected directly, for example from a reporting tool, works outside that mechanism and sees every organization’s data. It is sensible to give such accounts read-only access, and to route integrations that write data through the platform’s API rather than through SQL.