The Commands You Run Every Day
7 min read
Long CLI commands are easy to forget and hard to share. Scripts in package.json wrap them as short names the whole team runs the same way: yarn dev, yarn test, yarn build.
Vocabulary
| Term | Meaning |
|---|---|
| Script | A named shell command in package.json |
| Lifecycle script | Built-in names like start, test that npm/yarn recognize |
| Chained script | Runs multiple commands: yarn lint && yarn test |
Steps
How to add a script
json
Run with yarn dev, yarn build, or yarn check.
Reference — development
| Command | What it does |
|---|---|
yarn dev |
Hot-reload dev server on port 3000 |
yarn dev:stack |
Docker Postgres + migrate + dev server — best first-day setup |
yarn preview |
Build production output and preview locally |
dev:stack runs docker compose up — it starts Postgres, applies migrations, and launches the app in one foreground process.
Reference — database
| Command | What it does |
|---|---|
yarn db:generate |
Regenerate Prisma client after schema changes |
yarn db:migrate |
Create and apply migrations in development |
yarn db:seed |
Load starter/demo content |
yarn db:studio |
Open visual browser for tables and rows |
yarn db:reset |
Wipe DB and re-run all migrations |
Reference — quality
| Command | What it does |
|---|---|
yarn lint |
ESLint — catch bugs and style issues |
yarn format |
Prettier check |
yarn test |
All Vitest projects (unit + Storybook) |
yarn test:unit |
Logic tests in jsdom |
yarn test:storybook |
Component tests in headless Chromium |
yarn storybook |
Component catalog on port 6006 |
Reference — production
| Command | What it does |
|---|---|
yarn build |
Production bundle |
yarn start |
Serve built app (no migrations) |
yarn start:prod |
Run migrations, then serve — used by Docker and Railway |
Common pitfalls
- Running raw
prismacommands with wrong flags — use the wrapped scripts. - Using
yarn startin production without migrations — schema falls behind code. - Forgetting
db:generateafter pulling schema changes — TypeScript errors everywhere.
Verify it works
Run yarn dev:stack. Browser opens at localhost:3000. Prisma Studio at yarn db:studio shows seeded rows.
Takeaway
Scripts are team vocabulary. Wrap anything you run daily so nobody memorizes flags.