From Zero to a Running Nest App in 60 Seconds
Installing & Bootstrapping Nest
Install the Nest CLI, scaffold your first app, and run the dev server in under a minute.
What you'll learn
- Install the Nest CLI globally
- Scaffold a new project with `nest new`
- Run the dev server
The fastest way into Nest is the official CLI. It installs a scaffold with TypeScript, Jest, ESLint, and a working “hello world” endpoint already wired up.
Install the CLI
npm i -g @nestjs/cli
nest --version You can also run it without a global install via npx @nestjs/cli, but for
day-to-day work the global binary is more pleasant.
Scaffold a Project
nest new my-app The CLI asks which package manager you want (npm, yarn, or pnpm) and then installs dependencies. When it finishes you have:
my-app/
src/
app.controller.ts
app.controller.spec.ts
app.module.ts
app.service.ts
main.ts
test/
package.json
tsconfig.json
nest-cli.json Run It
cd my-app
npm run start:dev That starts Nest in watch mode on port 3000. Hit http://localhost:3000 in
a browser and you’ll see Hello World! — served by AppController calling
AppService. The dev server reloads on every file change.
What Each Generated File Does
main.ts— the entry file; creates the app and callslisten().app.module.ts— the root module; registers controllers and services.app.controller.ts— a sample HTTP controller with one@Gethandler.app.service.ts— the service the controller depends on.*.spec.ts— unit tests, colocated next to their subject.
Don’t worry about the details yet; the next lessons unpack each piece.
The Nest CLI →