Your first project
This walks through the most common pair: a nest-api
and a react-app talking to it, both on your
machine. You need Node 24, Docker, and Yarn through Corepack
(corepack enable).
1. Generate the API
Section titled “1. Generate the API”stack new nest-api ~/code/shop/api --name shop-apiThe report lists the features you got and the ones left out. Then the hooks run:
.env is seeded from .env.example, dependencies install, the code is
formatted, the Prisma client is generated, and a first commit is made.
-
Finish
.env. Two values are empty on purpose, because they’re per project:SMTP_USERandSMTP_PASSWORD. The API refuses to start without them. For local development, point SMTP at a mail catcher (see SMTP). Set a realBETTER_AUTH_SECRETtoo:Terminal window openssl rand -base64 32 -
Start PostgreSQL and Redis, then wait for them:
Terminal window cd ~/code/shop/apiyarn dc:up && yarn dc:wait -
Create the database schema and the admin user:
Terminal window yarn db:migrate # asks for a migration name, e.g. "init"yarn db:seed # creates SUPERUSER_EMAIL with SUPERUSER_PASSWORD -
Run it:
Terminal window yarn startOpen http://localhost:5000/docs (basic auth:
BASIC_AUTH_USER/BASIC_AUTH_PASSfrom.env) for the API reference, and /health to see every check pass.
2. Generate the web app
Section titled “2. Generate the web app”stack new react-app ~/code/shop/web --name shop-webcd ~/code/shop/webyarn devOpen http://localhost:3000. You’re sent to /login:
sign in as the superuser from step 3, and you land in the app. The defaults
already agree: the app calls the API at http://localhost:5000, and the API
allows http://localhost:3000.
3. Add a worker (optional)
Section titled “3. Add a worker (optional)”stack new node-worker ~/code/shop/worker --name shop-workerCopy the API’s prisma/schema/*.prisma into the worker’s prisma/schema/,
then yarn db:generate && yarn dev. Its .env already points at the same
PostgreSQL and Redis. See node-worker development.
What’s next
Section titled “What’s next”- Setup checklist: everything a project needs before it goes anywhere near production.
- Connecting services: each service, local and production.
- A full-stack project: how the pieces fit together.