NestJS 12: ESM, Vitest, and Standard Schema
NestJS 12 is the next major release of the progressive Node.js framework, targeting early Q3 2026. The team has published a draft pull request outlining the scope, and the changes are substantial—this is not an incremental bump.
ESM by default
The headline change is a full migration of every official NestJS package from CommonJS to ESM. The missing piece that made the move practical was Node.js gaining native require(esm) support, which means existing CommonJS projects can load ESM modules without a build-step workaround. Framework creator Kamil Myśliwiec expects the transition to introduce minimal friction for most projects.
New projects scaffolded with the Nest CLI will be ESM-first. Existing CommonJS projects can continue loading NestJS packages unchanged via Node.js's CJS-to-ESM bridge.
Vitest replaces Jest
For ESM projects, Vitest is now the default test runner. All NestJS repositories and sample apps have already migrated from Jest to Vitest. TypeScript decorator support in tests is handled by OXC rather than ts-jest.
CJS projects that stay on Jest are not affected—Vitest is only the default for new ESM projects.
# New ESM project — same command, Vitest runs under the hood
npm test
Standard Schema in route decorators
NestJS 12 adds native Standard Schema support directly in route decorators such as @Body(), @Query(), and @Param(). The new schema option accepts any Standard Schema–compliant library:
import { z } from 'zod';
@Post()
create(@Body({ schema: z.object({ name: z.string() }) }) dto: CreateUserDto) {
// dto is fully validated and typed by Zod
}
This makes Zod, Valibot, ArkType, and other modern validation libraries first-class citizens—no more mandatory class-validator and class-transformer setup that has been the NestJS default for years.
Toolchain modernisation
Several default tools are swapped across the board:
| Before | After |
|---|---|
| Jest | Vitest |
| ESLint | oxlint |
| Webpack | Rspack |
oxlint is written in Rust and is significantly faster than ESLint on large codebases. Rspack is a Rust-based Webpack-compatible bundler that dramatically reduces build times. Neither change affects how you write application code.
Other changes
- NATS v3 migration for the microservices package
- Graceful shutdown for the Express adapter
- WebSocket disconnect reason parameters—handlers can now inspect why a client disconnected
What to do now
NestJS 12 is not yet released; packages are being published under the next npm tag for early feedback:
npm install @nestjs/core@next @nestjs/common@next
A migration guide from v11 to v12 has not been published yet. The team plans to release it alongside the stable package.
Full details are in the GitHub draft PR #16391 and the InfoQ announcement.
If you are starting a new NestJS project today, build with current v11 patterns but keep an eye on the ESM defaults—your test and build configuration will look different when 12 ships.