nest-monorepo development
First run
Section titled “First run”-
Fill in
apps/api/.env(database, Redis,BETTER_AUTH_SECRET, SMTP) and giveapps/worker/.envthe sameDATABASE_URLandREDIS_*. -
Start Postgres and Redis, and wait until they accept connections:
Terminal window yarn dc:up && yarn dc:wait -
Create the first migration and seed:
Terminal window yarn db:migrate --name inityarn db:seed -
Run every app:
Terminal window yarn dev # the API on http://localhost:5000/docs, plus the worker
Commands
Section titled “Commands”From the root, turbo runs each across every workspace, building @scope/db
first:
yarn build | typecheck | lint | testyarn formatOne workspace: yarn workspace @scope/api <script>, or the script from the
app’s folder.
Changing the schema
Section titled “Changing the schema”-
Edit
packages/db/prisma/schema/*.prisma. -
From the root or
apps/api:Terminal window yarn db:migrate --name add_thingsThis runs
prisma migrate devin@scope/dbwith the API’s.env, then rebuilds the client. -
Restart
yarn dev, and runyarn typecheckfrom the root: it checks every app against the new client at once.
The API’s suites, as in nest-api, run from
apps/api against compose.test.yml (ports 5499 / 6399):
cd apps/apiyarn test:dc:reinstall # once: test stack up, schema pushed, seededyarn test # unityarn test:e2e # e2eTask skills
Section titled “Task skills”Each app ships its own Claude Code skills in apps/<app>/.claude/skills/, and
a root CLAUDE.md describes the workspace.
apps/api
Section titled “apps/api”| Skill | Ships with | What it does |
|---|---|---|
add-config | Every project | Add an environment variable to this API end to end — validated by the Zod config schema, mapped into the typed config, exposed through CustomConfigService, and documented in .env.example. |
add-model | Every project | Add or change a Prisma model in this API — the schema file, relations, enums, the migration, seed data — following the template's naming conventions. |
add-resource | Every project | Add a resource to this API — a Nest module with its controller, service, Zod DTOs and response entities, permission checks and tests — following the users module. |
add-email | mail | Add a transactional email to this API — the job type, its data, a React Email template, the render step in the mail processor, the MailService method and its test double. |
add-job | queue | Add background work to this API with BullMQ — register a queue, produce jobs with retries, and consume them in a processor here or in a separate worker. |
add-notification | notifications | Add a new kind of in-app notification to this API — the NotificationType, its data shape, and dispatching it from the action that causes it. |
add-realtime-event | realtime | Add a Socket.IO event to this API — pushing a change to connected clients (a user, a room, a channel, everyone) or handling a message from them, with the right rooms and permissions. |
apps/worker
Section titled “apps/worker”| Skill | Ships with | What it does |
|---|---|---|
add-worker | queue | Add a BullMQ queue consumer to this worker for a job the API produces — the queue name, a typed handler, registration and shutdown. |
add-workflow | temporal | Add a Temporal workflow and its activities to this worker — durable, multi-step work the API starts by name (onboarding sequences, provisioning, refunds, anything that waits or must not half-happen). |