Database
The Flow-Like API uses a relational database for platform data. In this repo, the schema is expressed as Prisma schema files under:
packages/api/prisma/schema/
CockroachDB vs PostgreSQL
Section titled “CockroachDB vs PostgreSQL”The Prisma schemas declare:
provider = "cockroachdb"
For PostgreSQL environments (local dev, many Kubernetes clusters), the repo includes a helper script:
packages/api/scripts/make-postgres-prisma-mirror.sh
It copies the schema tree to packages/api/prisma-postgres-mirror/schema and rewrites provider to postgresql.
Applying the schema
Section titled “Applying the schema”Local development (recommended)
Section titled “Local development (recommended)”The Kubernetes backend ships a docker-compose.yml that starts Postgres/Redis and applies the schema.
cd apps/backend/kubernetescp .env.example .env# edit .env
docker compose up -dThe db-migrate service uses the tooling in packages/api to run:
- mirror schema to PostgreSQL
prisma db pushagainstDATABASE_URL
Manual migration (host tools)
Section titled “Manual migration (host tools)”cd apps/backend/kubernetes./scripts/migrate-db.shManual migration (Docker)
Section titled “Manual migration (Docker)”cd apps/backend/kubernetes./scripts/migrate-db.sh --dockerKubernetes / Helm
Section titled “Kubernetes / Helm”The Helm chart contains a migration Job template:
apps/backend/kubernetes/helm/templates/db-migration-job.yaml
Important:
- Today it is a hook job intended to run pre-install / pre-upgrade.
- You still need to ensure the job image has access to the Prisma schema and tooling. If you don’t ship a purpose-built migration image, you can run migrations out-of-band (CI/CD step or an admin job).
Runtime configuration
Section titled “Runtime configuration”The API runtime expects:
DATABASE_URL(required)
This is read by flow_like_api::state::State.