PostgreSQL, Prisma & Local Auth
Local development only. The default local stack now runs a Docker-backed PostgreSQL database and a setup-seeded username/password login.
Services Used
| Service | Purpose |
|---|---|
| PostgreSQL | Stores workflows, projects, integrations, environments, and secrets |
| Prisma | Provides the API schema, client, and local database bootstrap |
| Local auth | Issues JWT bearer tokens for the setup-configured username/password |
Local Defaults
./start-local.sh now starts the local Postgres container automatically from docker-compose.yml. By default it uses:
postgresql://postgres:postgres@127.0.0.1:5432/playrunner?schema=public
These values come from the repo-root .env.local file, which is created from .env.local.example on first run if it does not already exist.
If you change POSTGRES_PORT in the repo-root .env.local, both the Docker bind and the setup form's default DATABASE_URL move with it automatically.
On the normal startup path it also runs:
cd apps/api
npm run prisma:generate
npx prisma db push --skip-generate
How the local database config flows
- The repo-root
.env.localdefines the local web port, setup installer port, and Docker-backed Postgres connection defaults. - When setup is active,
./start-local.shstarts Postgres with those values and passes the derivedDATABASE_URLinto the setup app. - The setup installer writes the chosen
DATABASE_URLintoapps/api/.envand stores the local admin username/password settings in PostgreSQL. ./start-local.shlater reuses that config, and if you are still using the standard Docker-backed Postgres settings it keepsapps/api/.envaligned with the repo-root.env.localbefore running Prisma bootstrap.
Stored Auth Config
The setup wizard stores the local admin username, password hash, and JWT signing secret in PostgreSQL.
The web login page calls POST /api/auth/login, the API verifies the configured credentials, and successful logins receive a local JWT.
Prisma Models
The local schema currently includes:
ProjectWorkflowConnectionEnvironmentSecret
The schema lives in apps/api/prisma/schema.prisma, and the shared Prisma client is exported from apps/api/src/lib/prisma.ts.
Web Data Access
All app-side persistence still flows through apps/frontend/src/lib/db.ts, but that module now talks to Prisma-backed API routes under /api/store/*.
Key routes include:
GET/POST/PUT/DELETE /api/store/projects
GET/POST/PUT/DELETE /api/store/workflows
GET/PUT/DELETE /api/store/integrations/:provider
GET/PUT/DELETE /api/store/cloud-credentials/:provider
GET/PUT/DELETE /api/store/environments/:id
PUT /api/store/secrets/:secretKey
Integration and cloud credentials share the Connection model and are
distinguished by kind. Public store reads return non-secret config and a
credentialStatus; package API routes and workflow execution resolve decrypted
secrets on the server. OAuth refresh also runs on the server and writes updated
tokens back as encrypted secrets.