NestJS Setup

The Nest CLI scaffolds and manages projects. Install it, generate a project, and you have a working, well-structured app in seconds.

Create a project

bash
npm install -g @nestjs/cli
nest new my-app
cd my-app
npm run start:dev

The dev server runs on http://localhost:3000 and reloads on every change.

Generating building blocks

The CLI generates boilerplate consistently β€” files, tests, and module wiring β€” so you don't create them by hand.

bash
nest generate module users       # or: nest g module users
nest g controller users
nest g service users
nest g resource users            # a full CRUD resource in one command
CommandCreates
g modulea feature module
g controllera controller (+ spec)
g servicea service/provider (+ spec)
g resourcemodule + controller + service + DTOs + CRUD

Useful scripts

bash
npm run start:dev    # watch mode (development)
npm run build        # compile to dist/
npm run start:prod   # run the compiled build
npm run test         # run unit tests
Tip: nest g resource users is the fastest way to see a complete, idiomatic CRUD feature β€” a great template to learn from and adapt.
Free preview. Sign in and subscribe to unlock all 809 lessons across 25 courses.
NestJS Setup β€” NestJS | Full Stack Learning Simplified