🛠️NestJS 12 Ships with ESM, Observability, and More
NestJS 12 brings ESM, observability, and schema validation out of the box
TL;DR
NestJS 12 introduces ESM support, native observability, and schema validation out of the box. Requires Node.js 20.19+ or 22.12+. Upgrading moves all @nestjs/* packages to v12 and bumps TypeScript to v6.
NestJS 12 has landed, bringing ESM support, native observability, and schema validation out of the box. The new version requires Node.js 20.19+ or 22.12+ and comes with a rebuilt CLI that asks whether to generate a CJS or ESM project. ESM projects default to Vitest and oxlint, while Rspack replaces webpack as the monorepo bundler. Route decorators now accept a schema option, and Zod, Valibot, and ArkType work without third-party wrappers once the new pipe is registered. Upgrading from v11 involves installing the latest CLI and running nest upgrade, which moves every @nestjs/* package to v12 and bumps TypeScript to v6. This affects teams using NestJS for server-side applications with TypeScript, and the migration guide covers the rest of the upgrade process.

Key Points
NestJS 12 requires Node.js 20.19+ or 22.12+ for ESM support.
NestJS CLI now asks whether to generate a CJS or ESM project.
ESM projects default to Vitest and oxlint, Rspack replaces webpack.
Route decorators accept a schema option for Standard Schema validation.
Upgrading from v11 moves all @nestjs/* packages to v12 and bumps TypeScript to v6.
Why It Matters
If you're using NestJS for server-side applications with TypeScript, NestJS 12's ESM support and native observability can streamline your development process. The new schema validation options, like Zod, Valibot, and ArkType compatibility, make it easier to enforce data integrity. However, upgrading from v11 requires a significant shift in dependencies and TypeScript version, so plan accordingly.
Comments
Be the first to comment
Enjoyed this article?
Get it daily. 7am. Free. Reads in 5 minutes.
Join 3,567 builders reading daily.