Skip to content

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).

Terminal window
stack new nest-api ~/code/shop/api --name shop-api

The 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.

  1. Finish .env. Two values are empty on purpose, because they’re per project: SMTP_USER and SMTP_PASSWORD. The API refuses to start without them. For local development, point SMTP at a mail catcher (see SMTP). Set a real BETTER_AUTH_SECRET too:

    Terminal window
    openssl rand -base64 32
  2. Start PostgreSQL and Redis, then wait for them:

    Terminal window
    cd ~/code/shop/api
    yarn dc:up && yarn dc:wait
  3. 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
  4. Run it:

    Terminal window
    yarn start

    Open http://localhost:5000/docs (basic auth: BASIC_AUTH_USER / BASIC_AUTH_PASS from .env) for the API reference, and /health to see every check pass.

Terminal window
stack new react-app ~/code/shop/web --name shop-web
cd ~/code/shop/web
yarn dev

Open 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.

Terminal window
stack new node-worker ~/code/shop/worker --name shop-worker

Copy 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.