The API lives in apps/api and uses Express, TypeScript, Drizzle ORM and PostgreSQL 17.
Install, database and environment steps are in the local development guide, which is the one place they are kept.
- Check the prerequisites and install dependencies.
- Start PostgreSQL.
- Create
apps/api/.env. - Create the tables and load demo data.
- Optionally run the worker.
Run these from the repository root.
Start the API with reload at http://localhost:5050:
pnpm --filter karmacircle-api devpnpm --filter karmacircle-api lintpnpm --filter karmacircle-api type-checkpnpm --filter karmacircle-api buildRun the built API:
pnpm --filter karmacircle-api startRun the Jest and Supertest suite:
pnpm --filter karmacircle-api testThe suite uses a local database named karmacircle_test, which it creates and empties itself.
| Command | What it does |
|---|---|
pnpm --filter karmacircle-api db:generate |
Writes a SQL migration from the Drizzle schema |
pnpm --filter karmacircle-api db:migrate |
Applies pending migrations to DATABASE_URL |
pnpm --filter karmacircle-api db:seed |
Loads demo data into a local database |
Nothing migrates the database when the API starts.
Deploys run the migrations first (database hosting).
The performance scripts, perf:seed and perf:explain, are described in Database performance.
Interactive API documentation is at http://localhost:5050/docs while the API is running.
Use the existing route, service, schema and test patterns. Document API changes in the backend specs and the API contract, and update the frontend integration docs when a request or response shape changes. Run the relevant checks before opening a pull request.