NestJS Module 1 – Getting started with NestJS 12
Your first NestJS 12 project with the CLI
Create a NestJS 12 project with nest new, choose the ESM or CommonJS layout, read every generated file, then build, test, lint and run the starter.
What you will learn
- Check that a machine's Node.js can run a Nest 12 app and the CLI's generators
- Create a project with nest new and choose between the ESM (Vitest) and CommonJS (Jest) layouts
- Explain what main.ts, the root module, the controller, the service and the tests each do
- Build, test, lint and run the starter, and preview new code with nest generate --dry-run
Before you start
What you’ll learn · Before you start
What you will learn
- Check that a machine's Node.js can run a Nest 12 app and the CLI's generators
- Create a project with nest new and choose between the ESM (Vitest) and CommonJS (Jest) layouts
- Explain what main.ts, the root module, the controller, the service and the tests each do
- Build, test, lint and run the starter, and preview new code with nest generate --dry-run
Before you start
On this page
nest new tiffintrail writes 15 files in a few seconds, and every one of them has a job: one starts the server, one
wires the classes together, two answer the first request, two test it, and the other nine are the README,
package.json and the settings of the CLI, TypeScript, the test runner, the linter and the formatter. Knowing which
file does what is the difference between changing the starter with confidence and guessing.
This lesson creates the starter of TiffinTrail, the tiffin service this track builds, with the Nest CLI 12.0.8. You
will check the two Node.js versions Nest 12 asks for, choose between the ESM and CommonJS layouts, read every
generated file, build, test, lint and run the result, and preview new code with nest generate.
Check Node.js twice: once to run, once to generate
Nest 12 asks for two different minimum versions of Node.js. Running an app needs one; the CLI’s code generators need
a newer one. Each package states its own floor in the engines field of its package.json, so the first command of
the session below prints what this machine runs and what three installed packages ask for:
// Prints the Node.js that runs this program and the Node.js versions three installed Nest packages ask for.
import { readFileSync } from 'node:fs';
console.log(`This Node.js: ${process.version}`);
for (const name of ['@nestjs/core', '@nestjs/cli', '@nestjs/schematics']) {
const pkg = JSON.parse(readFileSync(`../starter/node_modules/${name}/package.json`, 'utf8'));
console.log(`${`${name} ${pkg.version}`.padEnd(28)} engines.node: ${pkg.engines?.node ?? '(none)'}`);
} Its output is the first part of the next session, under node engines.mjs. @nestjs/core says only >= 20, but
the migration guide is stricter: Nest 12’s packages are ES modules, and a CommonJS app can load them only through
require(esm), which Node.js has unflagged since 20.19 and 22.12. The generators in @nestjs/schematics 12.0.6 ask
for ^22.22.3 || ^24.15.0 || >=26.0.0, a floor they inherit from the Angular devkit they are built on.
| Node.js | Runs a Nest 12 app | Runs nest new and nest generate |
|---|---|---|
| 20.19 | yes | no |
| 22.12 | yes | no |
| 22.22.3 | yes | yes |
| 24.15 | yes | yes |
| 24.21.0, this track | yes | yes |
| 26 | yes | yes |
Pin Node.js for the whole team
Put one version in the project, where every tool reads it: a .node-version, .nvmrc or mise.toml file for the
version managers, and engine-strict=true in the project’s .npmrc, which makes npm refuse any package whose
engines field rules out the running Node.js. Then a CI image on 22.12 fails at its first npm ci, because the
generators’ packages rule it out, instead of in the middle of nest generate.
Checkpoint
Check: The two Node.js floors of Nest 12
nest new writes fifteen files
This session prints the versions, then runs the CLI’s new command the way you would, with four flags explained
below, and finally compares the new project with the starter folder of this lesson:
import { session } from '../session.mjs';
// The CLI of the starter's own dependencies creates a new project here, without installing packages (the session
// has no network), and diff compares it with the starter folder of this lesson: no output means the same files.
session(
`
node engines.mjs
nest --version
nest new tiffintrail --skip-install --skip-git --package-manager npm --no-observe
diff -r -x README.md -x package-lock.json -x node_modules -x first-request.mjs tiffintrail ../starter
`,
{ packages: '../starter' },
); Output
$ node engines.mjs
This Node.js: v24.21.0
@nestjs/core 12.1.2 engines.node: >= 20
@nestjs/cli 12.0.8 engines.node: >= 20.11
@nestjs/schematics 12.0.6 engines.node: ^22.22.3 || ^24.15.0 || >=26.0.0
$ nest --version
12.0.8
$ nest new tiffintrail --skip-install --skip-git --package-manager npm --no-observe
✨ We will scaffold your app in a few seconds..
CREATE tiffintrail/.oxlintrc.json (206 bytes)
CREATE tiffintrail/.prettierrc (52 bytes)
CREATE tiffintrail/README.md (6981 bytes)
CREATE tiffintrail/nest-cli.json (171 bytes)
CREATE tiffintrail/package.json (1430 bytes)
CREATE tiffintrail/tsconfig.build.json (170 bytes)
CREATE tiffintrail/tsconfig.json (601 bytes)
CREATE tiffintrail/vitest.config.e2e.ts (245 bytes)
CREATE tiffintrail/vitest.config.ts (350 bytes)
CREATE tiffintrail/src/app.controller.ts (277 bytes)
CREATE tiffintrail/src/app.module.ts (255 bytes)
CREATE tiffintrail/src/app.service.ts (142 bytes)
CREATE tiffintrail/src/main.ts (237 bytes)
CREATE tiffintrail/src/app.controller.spec.ts (623 bytes)
CREATE tiffintrail/test/app.e2e-spec.ts (731 bytes)
Thanks for installing Nest 🙏
Please consider donating to our open collective
to help us maintain this package.
🍷 Donate: https://opencollective.com/nest
$ diff -r -x README.md -x package-lock.json -x node_modules -x first-request.mjs tiffintrail ../starter
Recorded with Node.js 24.21.0 on macOS 26 arm64. To run it yourself: mise exec node@24.21.0 -- node new.mjs
The flags: --skip-install because this recorded session has no network (on your machine, leave it out and let the
CLI install the packages), --skip-git to skip git init, --package-manager npm to skip the question about npm,
Yarn, pnpm or Bun, and --no-observe to skip the question about the Nest team’s hosted monitoring SDK, which this
track does not use. In a terminal, nest new also asks which module system to use; without a terminal it takes the
default, ESM.
diff printed nothing, so the starter folder below is exactly what the CLI wrote, apart from the README, the
lock file this lesson adds to pin every package version, and first-request.mjs, the one file of the lesson. Here
is what each generated file is for:
| File | Its job |
|---|---|
src/main.ts |
Creates the app from AppModule and starts listening |
src/app.module.ts |
The root module: The module passed to NestFactory.create() in main.ts, AppModule in a new project. Nest builds the app by reading it and every module it imports.: lists the controller and the provider |
src/app.controller.ts |
Answers GET / |
src/app.service.ts |
Holds the logic the controller calls |
src/app.controller.spec.ts |
A unit test of the controller |
test/app.e2e-spec.ts |
An end-to-end test: A test that starts the whole app and sends it real HTTP requests, as test/app.e2e-spec.ts does with supertest, rather than calling one class directly. over HTTP |
package.json |
Dependencies and the npm scripts |
tsconfig.json, tsconfig.build.json |
Compiler settings, and which files a build includes |
nest-cli.json |
Settings of the Nest CLI: The nest command of @nestjs/cli: it creates projects (nest new), generates files (nest generate), builds them (nest build) and starts them (nest start). |
vitest.config.ts, vitest.config.e2e.ts |
The test runner for unit and end-to-end tests |
.oxlintrc.json, .prettierrc |
The linter’s rules and the formatter’s style |
README.md |
Instructions for the project |
Checkpoint
Check: What nest new generates
main.ts starts one module, and the module wires the rest
Four files make the app. Read them in the order Nest uses them:
TypeScript (main.ts) · starter/src/main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module.js';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(process.env.PORT ?? 3000);
}
await bootstrap(); TypeScript (app.module.ts) · starter/src/app.module.ts
import { Module } from '@nestjs/common';
import { AppController } from './app.controller.js';
import { AppService } from './app.service.js';
@Module({
imports: [],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {} TypeScript (app.controller.ts) · starter/src/app.controller.ts
import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service.js';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
getHello(): string {
return this.appService.getHello();
}
} TypeScript (app.service.ts) · starter/src/app.service.ts
import { Injectable } from '@nestjs/common';
@Injectable()
export class AppService {
getHello(): string {
return 'Hello World!';
}
} main.ts hands AppModule to NestFactory.create(). The module’s @Module() decorator lists one controller and
one provider. The controller’s constructor asks for an AppService, and the service is marked @Injectable(), so
Nest can create it and pass it in. Step through what happens when main.ts runs, and the first request after it:
The drawing shows the whole scene; its 7 steps are listed below.
Every step as text
- Start. main.ts calls NestFactory.create(AppModule). Nest logs "Starting Nest application..." and reads the @Module() decorator of AppModule: one controller, one provider, no imports.
- Providers. AppService has no constructor parameters, so Nest creates it first and keeps that one instance for every class that asks for it.
- Controllers. AppController's constructor asks for an AppService. Nest finds that type in the recorded metadata of the constructor and passes in the instance it already built; the controller never calls new itself. With the providers and the controller built, Nest logs "AppModule dependencies initialized".
- Routes. Nest reads @Controller() and @Get() and registers one Express route. The log shows it as "AppController {/}:" and then "Mapped {/, GET} route".
- Listen. app.listen(process.env.PORT ?? 3000) opens the port, and Nest logs "Nest application successfully started". Everything so far happened once; from now on Nest only answers requests.
- A request. A browser asks for GET /. Express receives it and calls the route Nest registered, which calls getHello() on the one AppController instance.
- The answer. getHello() returns the string Hello World! from AppService. Nest sends it with status 200, and Express marks it text/html with X-Powered-By: Express and an ETag.
Two details of the ESM layout show in these files. Relative imports end in .js, as in './app.module.js', even
though the source file is app.module.ts, because the import names the file the compiler will write. And main.ts
ends with await bootstrap(); at the top level of the file, which only an ES module: A JavaScript file that uses import and export, the module format of the language standard. In Node.js a .js file is one when the nearest package.json says "type": "module". may
do.
Key idea
Nest builds the whole object graph once, at start-up: providers first, then the controllers that ask for them, then one route per handler. A request only runs methods on objects that already exist.
Checkpoint
Check: How the starter boots
Build, test, lint and run the starter
The starter’s package.json defines the scripts you will use every day. This session runs five of them in the
starter folder, then starts the built app once with first-request.mjs and sends it one request:
import { session } from '../session.mjs';
// The starter's own scripts, then one request to the built app. --reporter=verbose makes Vitest list every test.
session(
`
cd ../starter
npm run build
ls dist
npm test -- --reporter=verbose
npm run test:e2e -- --reporter=verbose
npm run lint
node first-request.mjs
`,
{ packages: '../starter' },
); Output
$ cd ../starter
$ npm run build
> tiffintrail@0.0.1 build
> nest build
$ ls dist
app.controller.d.ts
app.controller.js
app.controller.js.map
app.module.d.ts
app.module.js
app.module.js.map
app.service.d.ts
app.service.js
app.service.js.map
main.d.ts
main.js
main.js.map
$ npm test -- --reporter=verbose
> tiffintrail@0.0.1 test
> vitest run --reporter=verbose
The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
RUN v4.1.11 .
✓ src/app.controller.spec.ts > AppController > root > should return "Hello World!"
Test Files 1 passed (1)
Tests 1 passed (1)
Start at <time>
Duration <time>
$ npm run test:e2e -- --reporter=verbose
> tiffintrail@0.0.1 test:e2e
> vitest run --config ./vitest.config.e2e.ts --reporter=verbose
The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
RUN v4.1.11 .
✓ test/app.e2e-spec.ts > AppController (e2e) > / (GET)
Test Files 1 passed (1)
Tests 1 passed (1)
Start at <time>
Duration <time>
$ npm run lint
> tiffintrail@0.0.1 lint
> oxlint --type-aware src/ test/
Found 0 warnings and 0 errors.
Finished in <time> on 6 files with 111 rules using <n> threads.
$ node first-request.mjs
[Nest] <pid> - <time> LOG [NestFactory] Starting Nest application...
[Nest] <pid> - <time> LOG [InstanceLoader] AppModule dependencies initialized +<n>ms
[Nest] <pid> - <time> LOG [RoutesResolver] AppController {/}: +<n>ms
[Nest] <pid> - <time> LOG [RouterExplorer] Mapped {/, GET} route +<n>ms
[Nest] <pid> - <time> LOG [NestApplication] Nest application successfully started +<n>ms
GET / -> 200 Hello World!
content-type: text/html; charset=utf-8
x-powered-by: Express
etag: W/"c-Lve95gjOVATpfV8EL5X4nxwjKHE"
Recorded with Node.js 24.21.0 on macOS 26 arm64. To run it yourself: mise exec node@24.21.0 -- node scripts.mjs
// Starts the built starter on a port the system picks, sends GET / as a browser would, prints the answer and stops.
// Run it after npm run build: it imports the compiled module from dist/.
import { NestFactory } from '@nestjs/core';
import { AppModule } from './dist/app.module.js';
const app = await NestFactory.create(AppModule);
await app.listen(0, '127.0.0.1');
const res = await fetch(`${await app.getUrl()}/`);
console.log(`GET / -> ${res.status} ${await res.text()}`);
for (const name of ['content-type', 'x-powered-by', 'etag']) console.log(` ${name}: ${res.headers.get(name)}`);
await app.close(); What each command did:
| Command | What it runs | What it showed |
|---|---|---|
npm run build |
nest build, which compiles src/ with TypeScript |
dist/ with .js, .d.ts and .js.map files |
npm test |
Vitest on the *.spec.ts files |
1 test passed: getHello() returns Hello World! |
npm run test:e2e |
Vitest on *.e2e-spec.ts, with supertest |
1 test passed: GET / answers 200 |
npm run lint |
oxlint with type-aware rules | 0 warnings and 0 errors in 6 files |
node first-request.mjs |
the built app, one request | the boot log, then 200 Hello World! |
A few lines of that output are worth reading closely. The boot log is the figure above in words: AppModule dependencies initialized, then Mapped {/, GET} route. The answer arrived as text/html, because Express sends a
string as HTML, with X-Powered-By: Express and an ETag. And Vite, which Vitest runs on, notes that the
vite-tsconfig-paths plugin of the generated config is no longer needed; it is a notice, and the tests still pass.
The two scripts that keep running are not in the session: npm run start builds and starts the app on port 3000,
and npm run start:dev also watches src/ and restarts on every change.
Checkpoint
Check: Build, test, lint and run
ESM or CommonJS: what the question changes
When nest new asks for a module system, it chooses between two templates that @nestjs/schematics ships: one for
ES modules with Vitest, which is the default, and one for CommonJS: Node.js's older module format, with require() and module.exports. A .js file is CommonJS unless the nearest package.json says "type": "module". with Jest. This program
reads both templates from the installed package and prints how they differ:
// Compares the two project templates that nest new chooses between when it asks for a module system:
// ts-esm (ES modules, Vitest) and ts (CommonJS, Jest), as @nestjs/schematics ships them.
import { readFileSync } from 'node:fs';
const root = '../starter/node_modules/@nestjs/schematics/dist/lib/application/files';
const read = (template, file) => readFileSync(`${root}/${template}/${file}`, 'utf8');
// The templates hold EJS tags; fill them in as nest new does for a TypeScript project without the monitoring SDK.
const render = (text) => text.replace(/<% if \(observe\) \{ %>[\s\S]*?<% \} %>/g, '').replace(/<%= strict %>/g, 'true').replace(/<%=[^%]*%>/g, '');
const json = (template, file) => JSON.parse(render(read(template, file)));
const pkg = { esm: json('ts-esm', 'package.json'), cjs: json('ts', 'package.json') };
const tsconfig = { esm: json('ts-esm', 'tsconfig.json'), cjs: json('ts', 'tsconfig.json') };
const main = { esm: render(read('ts-esm', 'src/main.ts')), cjs: render(read('ts', 'src/main.ts')) };
console.log(`package.json "type": ESM ${pkg.esm.type ?? '(not set)'} | CommonJS ${pkg.cjs.type ?? '(not set)'}`);
console.log('test script:');
console.log(` ESM ${pkg.esm.scripts.test}`);
console.log(` CommonJS ${pkg.cjs.scripts.test}`);
const only = (a, b) => Object.keys(pkg[a].devDependencies).filter((d) => !(d in pkg[b].devDependencies)).sort().join(', ');
console.log(`dev dependencies only in ESM: ${only('esm', 'cjs')}`);
console.log(`dev dependencies only in CommonJS: ${only('cjs', 'esm')}`);
console.log(`tsconfig types: ESM ${tsconfig.esm.compilerOptions.types.join(', ')} | CommonJS ${tsconfig.cjs.compilerOptions.types.join(', ')}`);
const importOf = (text) => /from '(\.\/app\.module[^']*)'/.exec(text)[1];
const lastLine = (text) => text.trim().split('\n').at(-1);
console.log(`main.ts imports the module from: ESM '${importOf(main.esm)}' | CommonJS '${importOf(main.cjs)}'`);
console.log(`main.ts ends with: ESM ${lastLine(main.esm)} | CommonJS ${lastLine(main.cjs)}`); import { session } from '../session.mjs';
session(
`
node templates.mjs
`,
{ packages: '../starter' },
); Output
$ node templates.mjs package.json "type": ESM module | CommonJS (not set) test script: ESM vitest run CommonJS node --experimental-vm-modules ./node_modules/jest/bin/jest.js dev dependencies only in ESM: @vitest/coverage-v8, vite-tsconfig-paths, vitest dev dependencies only in CommonJS: @types/jest, jest, ts-jest, ts-loader, ts-node, tsconfig-paths tsconfig types: ESM vitest/globals, node | CommonJS node, jest main.ts imports the module from: ESM './app.module.js' | CommonJS './app.module' main.ts ends with: ESM await bootstrap(); | CommonJS void bootstrap();
Recorded with Node.js 24.21.0 on macOS 26 arm64. To run it yourself: mise exec node@24.21.0 -- node run.mjs
The differences follow from one setting. "type": "module" in package.json makes Node.js treat every .js file
of the project as an ES module, so imports need their .js extension and main.ts may await at the top level.
Without it, the project is CommonJS, imports stay extension-less and main.ts ends with void bootstrap();. The
test runner follows: Vitest loads ES modules natively, while Jest runs through node --experimental-vm-modules so
that it can load Nest 12’s packages, which are ES modules even in a CommonJS project. The migration guide adds that
Jest can load them only on Node.js 24.9 or later.
For a new service, take the default, ESM with Vitest, unless your team’s tooling needs Jest. An existing CommonJS app does not have to change: Nest 12 runs it as it is.
Checkpoint
Check: ESM or CommonJS layout
nest generate adds a feature, and a dry run shows it first
nest generate, or nest g, runs a schematic: A code generator that the Nest CLI runs to create or change files, such as the application, controller and resource schematics of @nestjs/schematics. that writes the files of a new piece and
registers it in a module. --dry-run prints what it would do and writes nothing, which is the safe way to learn
what each schematic produces:
import { session } from '../session.mjs';
// What nest generate would write for a new "orders" feature, without writing it (--dry-run).
session(
`
cd ../starter
nest generate resource orders --dry-run
nest generate controller menus --dry-run
`,
{ packages: '../starter' },
); Output
$ cd ../starter $ nest generate resource orders --dry-run CREATE src/orders/orders.controller.spec.ts (582 bytes) CREATE src/orders/orders.controller.ts (924 bytes) CREATE src/orders/orders.module.ts (261 bytes) CREATE src/orders/orders.service.spec.ts (463 bytes) CREATE src/orders/orders.service.ts (629 bytes) CREATE src/orders/dto/create-order.dto.ts (31 bytes) CREATE src/orders/dto/update-order.dto.ts (176 bytes) CREATE src/orders/entities/order.entity.ts (22 bytes) UPDATE package.json (1463 bytes) UPDATE src/app.module.ts (325 bytes) Dry run enabled. No files written to disk. $ nest generate controller menus --dry-run CREATE src/menus/menus.controller.spec.ts (488 bytes) CREATE src/menus/menus.controller.ts (99 bytes) UPDATE src/app.module.ts (335 bytes) Dry run enabled. No files written to disk.
Recorded with Node.js 24.21.0 on macOS 26 arm64. To run it yourself: mise exec node@24.21.0 -- node generate.mjs
resource orders would create 8 files: a module, a controller and a service with their tests, two DTO classes and
an entity class, all under src/orders/. It would also update src/app.module.ts, to import the new
OrdersModule, and package.json. Run without --dry-run, it adds @nestjs/mapped-types to the dependencies,
because the generated UpdateOrderDto extends PartialType() from it, and installs it. controller menus writes
less: the controller and its test, and one update to AppModule. In a terminal, nest g resource also asks which
transport to use and whether to generate the CRUD methods; this recording took the defaults, a REST API with CRUD
methods.
Checkpoint
Check: nest generate and dry runs
Practise: build the starter yourself
Do this on your own computer with Node.js 24.15 or later:
Create, run and change the starter
Run npx @nestjs/cli@12.0.8 new tiffintrail and choose npm and ESM. In the new folder run npm run start:dev
and open http://localhost:3000/. Change the string in app.service.ts and watch the server restart. Then run
npx nest g resource menus --dry-run, read the plan, and run it again without --dry-run.
The questions mix the starter’s files, its scripts and the CLI; a wrong answer brings back a question on the same idea later in the session:
Practice that adapts to you
Practise this lesson
7 questions about 6 ideas of this lesson. Each answer is explained at once, and what you get right is kept in this browser.
Interview questions
Model answers open with any pass: ₹79 for 1 week ($2.99), one payment that never renews.
-
Fresher to mid · Warm-up
What does nest new generate, and which file starts the application?
It writes a ready-to-run project of 15 files with Nest CLI 12.0.8. src/main.ts starts the app: it passes AppModule to NestFactory.create() and calls app.listen(process.env.PORT ?? 3000). src/app.module.ts is the root module, which lists AppController and AppService; the controller answers GET / with the string the service returns. Two tests come with it, a unit test of the controller and an end-to-end test over HTTP with supertest. The other files configure the project: package.json with its scripts, tsconfig.json and tsconfig.build.json for the compiler, nest-cli.json for the CLI, two Vitest configs, and the oxlint and Prettier settings. In a terminal it first asks for a package manager, a module system (ESM with Vitest, the default, or CommonJS with Jest) and whether to set up the Nest team's observability package.
-
Mid to senior
A CI job that runs nest generate fails on an image with Node.js 22.12, although the app's own tests pass on the same image. Explain the two Node.js requirements of Nest 12, and how you would pin Node.js for the team and its CI.
-
Mid to senior
Your team is starting a Nest 12 service and nest new asks for a module system. Which do you choose, ESM or CommonJS, and what changes in imports, tests and tooling with each?
Key takeaways
- Running a Nest 12 app needs Node.js 20.19+ (22.12+ on the 22 line); the CLI’s generators need 22.22.3+, 24.15+ or 26+, so pin a version that meets both for the whole team.
nest newwrites 15 files:main.tsstarts the app,AppModulelists the controller and the provider, and the rest configure TypeScript, Vitest, oxlint and Prettier.- At start-up Nest creates
AppService, passes it toAppController’s constructor and mapsGET /; a request only calls methods on objects that already exist. npm run buildcompiles todist/,npm testandnpm run test:e2erun Vitest,npm run lintruns oxlint, and a string answer goes out astext/htmlwithX-Powered-By: Express.- ESM projects use
.jsin imports, top-levelawaitand Vitest; CommonJS projects use extension-less imports and Jest through--experimental-vm-modules. nest generatewrites a feature and registers it in a module;--dry-runshows the plan first.
Terms in this lesson
- CommonJS
- Node.js's older module format, with require() and module.exports. A .js file is CommonJS unless the nearest package.json says "type": "module".
- end-to-end test
- A test that starts the whole app and sends it real HTTP requests, as test/app.e2e-spec.ts does with supertest, rather than calling one class directly.
- ES module
- A JavaScript file that uses import and export, the module format of the language standard. In Node.js a .js file is one when the nearest package.json says "type": "module".
- Nest CLI
- The nest command of @nestjs/cli: it creates projects (nest new), generates files (nest generate), builds them (nest build) and starts them (nest start).
- root module
- The module passed to NestFactory.create() in main.ts, AppModule in a new project. Nest builds the app by reading it and every module it imports.
- schematic
- A code generator that the Nest CLI runs to create or change files, such as the application, controller and resource schematics of @nestjs/schematics.
References
- NestJS documentation: First steps (NestJS)
- NestJS documentation: CLI overview (NestJS)
- NestJS documentation: CLI command reference (NestJS)
- NestJS documentation: Migration guide (Node.js requirements, ESM, testing stack) (NestJS)
- NestJS documentation: Testing (NestJS)
- @nestjs/schematics on npm (npm)
- npm documentation: config, engine-strict (npm)
- Node.js documentation: Modules, determining the module system (OpenJS Foundation (Node.js))
- Vitest documentation: Reporters (Vitest)
- oxlint documentation: Usage (Oxc)
Related tools
Report a problem with this lesson
Kept only in this browser. Your Learn progress