Skip to content

fix(deps): update nest monorepo to v12 - #1282

Open
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/major-nest-monorepo
Open

fix(deps): update nest monorepo to v12#1282
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/major-nest-monorepo

Conversation

@renovate

@renovate renovate Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
@nestjs/common (source) ^11.0.16^12.0.0 age confidence
@nestjs/core (source) ^11.0.16^12.0.0 age confidence
@nestjs/platform-express (source) ^11.0.16^12.0.0 age confidence
@nestjs/schematics 11.1.012.0.0 age confidence
@nestjs/testing (source) ^11.0.16^12.0.0 age confidence

Release Notes

nestjs/nest (@​nestjs/common)

v12.0.1

Compare Source

v12.0.0

Compare Source

nestjs/nest (@​nestjs/core)

v12.0.1

Compare Source

v12.0.0

Compare Source

nestjs/nest (@​nestjs/platform-express)

v12.0.1

Compare Source

v12.0.0

Compare Source

NestJS v12.0.0

NestJS 12 is centered around ESM-ready packages, first-class Standard Schema support for validation and serialization, a rebuilt CLI, and native observability through the new @nestjs/observe SDK.

Existing CommonJS applications keep working — migrating your own code to ESM is entirely optional.

📖 Full migration guide


Upgrading

Upgrade the CLI first, since the upgrade command ships with it:

npm i -g @nestjs/cli@latest

Then, from the root of your project:

nest upgrade

nest upgrade moves every @nestjs/* package to its v12-compatible major at once and applies the mechanical parts of the migration for you — nest-cli.json webpack options, the GraphQL playgroundgraphiql rename and subscriptions transport swap, the NATS package replacement, @nestjs/config validation options, Jest and Joi bumps — then prints a report of everything it changed and everything you still need to review by hand. Run it with --dry-run first to see that report without touching your files.

It deliberately does not migrate your project to ESM, Vitest, or oxlint. Those are the defaults for newly generated projects; existing projects adopt them on their own schedule.

Node.js: v12 requires Node.js v20.19+ or v22.12+. Both require(esm) and the ESM packages depend on it; the upgrade command refuses to run on older releases (including the 21.x line). The latest active LTS is recommended.


Highlights

ESM packages

All core Nest packages now ship as ESM. Thanks to require(esm) in modern Node.js, most existing CommonJS applications continue to work without a rewrite. Review custom bootstrapping scripts, build tooling, and test runners if they assume CommonJS-only packages.

nest new now asks whether to scaffold a CommonJS or an ESM project.

Standard Schema validation

Route parameter decorators — @Body(), @Query(), @Param(), @RawBody() — accept a new schema option, designed for Standard Schema compatible libraries such as Zod, Valibot, and ArkType:

@Post()
create(@Body({ schema: createUserSchema }) body: CreateUserDto) {
  return this.usersService.create(body);
}

@Get(':id')
findOne(@Param('id', { schema: z.coerce.number().int().positive() }) id: number) {
  return this.usersService.findOne(id);
}

The decorator only attaches metadata; register the new StandardSchemaValidationPipe to validate against it:

app.useGlobalPipes(new StandardSchemaValidationPipe());

The same schemas feed OpenAPI generation. The decorator-based class-validator workflow remains fully supported, with no plan to remove it.

Standard Schema serialization

StandardSchemaSerializerInterceptor validates and transforms outgoing responses with the same ecosystem:

@UseInterceptors(StandardSchemaSerializerInterceptor)
@SerializeOptions({ schema: userResponseSchema })
@Get(':id')
findOne(@Param('id') id: string) {
  return this.usersService.findOne(id);
}

Pick per use case: ValidationPipe / ClassSerializerInterceptor for class-based DTOs, the Standard Schema variants when your schemas already exist.

Native observability — @nestjs/observe

The official NestJS Observe SDK plugs into Nest's own request lifecycle through the instrument application option, rather than patching the HTTP server like a generic APM agent. Requests, jobs, errors, and traces are reported in terms of your controllers, providers, resolvers, and queue consumers:

export const { ObserveModule, ObserveInstrument } = createObserveModule();

const app = await NestFactory.create(AppModule, {
  instrument: ObserveInstrument,
});

Auto-instrumentation covers HTTP, GraphQL, gRPC, and microservice transports, plus queue consumers and cron runs — no manual span wiring and no collector to run. Opt-in and new; nothing to migrate. nest new and nest upgrade can wire it up for you (--observe). See the Observability chapter.

Config module on Standard Schema

@nestjs/config moves from Joi-specific validation to Standard Schema. validationSchema now accepts any compatible schema:

ConfigModule.forRoot({
  validationSchema: z.object({
    NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
    PORT: z.coerce.number().default(3000),
  }),
});

Existing Joi schemas still work with two caveats: upgrade to Joi v18+ (the first release implementing Standard Schema), and move library-specific settings under validationOptions.libraryOptions.

Route conflict diagnostics

Routes are registered in declaration order, so on order-sensitive adapters @Get(':id') can silently shadow a @Get('me') declared after it. Two opt-in options surface this:

const app = await NestFactory.create(AppModule, {
  routeConflictPolicy: { duplicate: 'error', shadow: 'warn' },
  routeResolutionStrategy: 'specificity',
});

Both default to the previous behavior, so nothing changes unless you set them.

Machine-readable error codes

HttpExceptionOptions accepts an errorCode that is serialized into the response body, so clients branch on a stable identifier instead of parsing message strings:

throw new BadRequestException('Password is too weak', { errorCode: 'WEAK_PASSWORD' });
Structured logging params

ConsoleLogger now treats plain objects passed after the message as structured params of the same log entry instead of separate records:

logger.log('User created', { userId: 1, email: 'foo@bar.com' });

In JSON mode they nest under params, or spread into the root with flattenParams. On by default; set structuredParams: false to restore the old behavior.


CLI (@nestjs/cli v12)

The CLI was rebuilt in nestjs/nest-cli#3280: the entire source migrated to ESM, tests moved from Jest to Vitest, e2e tests were added for every command, and command classes were refactored to take typed context objects instead of untyped inputs and option arrays.

New commands

  • nest upgrade (alias update) — upgrades a v11 project to v12 and applies the migration steps described above.
  • nest deploy — deploys your application to the cloud via Mau, installing @nestjs/mau on first use and forwarding every argument straight through.

Defaults and tooling

  • Rspack is the new default bundler for monorepos. The --webpack / --webpackPath flags (and their webpack / webpackConfigPath counterparts in nest-cli.json) are deprecated in favor of --builder rspack.
  • oxlint replaces ESLint in generated projects.
  • Vitest is the default test runner for ESM projects; CommonJS projects continue with Jest.
  • bun is now a supported package manager, alongside npm, yarn, and pnpm.
  • The decorator schematic generates decorators using the preferred Reflector.createDecorator() form. The angular schematic has been removed.

New options

  • nest build / nest start: --rspackPath [path], --emit-declarations (SWC), --no-type-check, --silent
  • nest build: --parallel [concurrency], for building monorepo projects in parallel with --all
  • nest-cli.json: includeLibraryAssets, for copying library assets into an application build

Breaking changes

Change What to do
Packages ship as ESM Usually nothing — require(esm) keeps CommonJS apps working. Review custom bootstrapping, bundler, and test-runner config.
Node.js v20.19+ / v22.12+ required Upgrade Node; the 21.x line is not supported.
Lifecycle hooks are now invoked by component hierarchy level Review ordering assumptions between related providers/modules in init, teardown, and tests.
NATS v3 — the nats package is replaced by @nats-io/transport-node npm uninstall nats && npm install @nats-io/transport-node; update direct imports. Packets are now serialized as JSON strings and custom deserializers receive the full NATS message — read payloads with msg.json().
GraphQL subscriptionssubscriptions-transport-ws support removed Switch to graphql-ws; the protocols are wire-incompatible, so clients must be updated. Review onConnect callbacks.
GraphiQL is the default GraphQL IDE Replace playground with graphiql; pass an options object to customize.
@nestjs/config validates through Standard Schema Keep Joi by upgrading to v18+ and moving library settings under validationOptions.libraryOptions.
Pipe transform signatures refined; ArgumentMetadata is now generic Adjust hand-written custom pipe signatures if the compiler complains.
ConsoleLogger structured params on by default Set structuredParams: false to restore the previous output.
Webpack CLI workflows deprecated Migrate to --builder rspack.
angular schematic removed

Most of these are handled automatically by nest upgrade.


Also in this release

  • ValidationPipe error format — a new option controls the shape of validation error responses.
  • gRPC exception filterGrpcExceptionFilter and status-specific exceptions map errors to proper gRPC status codes instead of UNKNOWN.
  • Regex Kafka patterns@MessagePattern() and @EventPattern() accept a RegExp on the Kafka transport.
  • Request-scoped WebSocket gateways — gateways support request-scoped providers, with the socket injectable via the REQUEST token.
  • WebSocket disconnect reasonhandleDisconnect can receive the reason for the disconnection.
  • Microservices pre-request hook — a new hook runs before a message handler is invoked.
  • Express graceful shutdown — the Express adapter drains in-flight requests on shutdown.
  • HTTP adapter error mapping — reworked across core, Express, and Fastify adapters.

Thanks

Thank you to everyone who contributed code, issues, reproductions, and reviews to this release. 💛

If NestJS helps you build your products, consider supporting the project.

nestjs/schematics (@​nestjs/schematics)

v12.0.0

Compare Source

What's Changed

@nestjs/schematics is now a native ES module, and the major version is aligned with the Nest 12 release line. Beyond the package itself going ESM, the bigger change is what it generates: nest new now scaffolds ESM applications by default, and a brand-new nest upgrade schematic migrates existing v11 projects to v12.

ESM migration

The package is published as pure ESM ("type": "module", compiled with NodeNext). All internal imports carry explicit .js extensions and the build output is ESM-only.

The package now requires Node.js >= 22.12.0 and declares a typescript >= 6.0.0 peer dependency. prettier ^3 remains an optional peer, used only when --format is passed.

require(esm) — CommonJS still works

You do not need to convert your tooling to ESM. Thanks to Node's require(esm) support, CommonJS consumers can still require('@nestjs/schematics') on the supported Node versions, so custom collections and CJS scripts that drive the schematics programmatically keep working unchanged.

nest new generates ESM by default

The application schematic gained a type option (esm | cjs) that defaults to esm:

Which module system would you like to use?
> ESM (ES Modules)         [ with vitest ]
  CJS (CommonJS)           [ with jest ]
  • ESM projects get "type": "module", Vitest as the test runner (vitest.config.ts / vitest.config.e2e.ts), and "types": ["vitest/globals", "node"].
  • CJS projects keep Jest, but the Jest configuration has moved out of package.json into a dedicated jest.config.ts.

Pass --type cjs (or answer the prompt) to keep the classic CommonJS layout.

Generated project defaults

  • TypeScript 6, with module/moduleResolution set to nodenext, resolvePackageJsonExports: true, isolatedModules: true, and target: ES2023.
  • oxlint replaces ESLint. New projects ship an oxlint.json and a "lint": "oxlint src/ test/" script instead of the ESLint config and its plugin chain.
  • Rspack replaces webpack as the default builder in nest-cli.json.
  • Nest dependencies are pinned to the v12 line (@nestjs/common, @nestjs/core, @nestjs/platform-express, @nestjs/testing).

ESM-aware generators

Every element generator (module, controller, service, resource, middleware, pipe, …) now detects whether the target project is ESM and appends .js to generated relative imports accordingly — including the imports it injects into an existing @Module() when wiring up a newly generated element. CJS projects are unaffected.

New: nest upgrade

A new schematic (aliased nest update) migrates a Nest v11 project to v12. It refuses to run on anything that isn't v11, then applies the migration in steps and prints a report of every change, every follow-up action, and every warning.

Dependencies — bumps all known @nestjs/* packages to ^12.0.0 (GraphQL packages to ^14.0.0), raises typescript to ^6.0.0 and engines.node to >=20.19.0, and reports any @nestjs/* package whose v12-compatible release it doesn't know about.

tsconfig — flags module: commonjs with legacy module resolution and any moduleResolution that TypeScript 6 dropped, and points out a missing rootDir in tsconfig.build.json (TS6 error TS5011).

@nestjs/config — moves library-specific validationOptions (Joi's allowUnknown, abortEarly, …) under validationOptions.libraryOptions, and raises joi to ^18 for its Standard Schema support.

GraphQL — renames the removed playground option to graphiql, and switches subscriptions-transport-ws over to graphql-ws, updating package.json to match.

NATS — rewrites nats imports to the v3 @nats-io packages and warns about the dropped StringCodec/JSONCodec helpers and the new packet serialization (custom deserializers now receive the full NATS message; read it with msg.json()).

Testing — raises jest, @types/jest, and ts-jest to Jest 30, and warns that because the Nest 12 packages are ESM-only, Jest can only require() them on Node.js 24.9+ (older versions fail with ERR_REQUIRE_ASYNC_MODULE).

CLI config — migrates nest-cli.json builders from webpack to Rspack, drops the deprecated webpack: false option, updates affected package.json scripts, and asks you to port any custom webpack config file by hand.

Diagnostics — scans the project and warns about the refined PipeTransform#transform signature and generic ArgumentMetadata, the new ConsoleLogger structured-params behaviour (opt out with structuredParams: false), and the change to lifecycle hook ordering by component hierarchy level.

Options: --observe, --skip-install, --tag <dist-tag>, --format.

@nestjs/observe integration

Both nest new --observe and nest upgrade --observe can preconfigure the application with @nestjs/observe — distributed tracing, auto-correlated logs, metrics, and alarms. The schematic adds the dependency and wires createObserveModule() into the root module, then reminds you to set OBSERVE_APP_KEY and OBSERVE_APP_SECRET. It is opt-in and skipped when the package is already installed.


See the migration guide for the full picture.

nestjs/nest (@​nestjs/testing)

v12.0.1

Compare Source

v12.0.0

Compare Source


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot force-pushed the renovate/major-nest-monorepo branch from e71d0b5 to c8c91ca Compare August 27, 2026 17:31
@renovate
renovate Bot force-pushed the renovate/major-nest-monorepo branch from c8c91ca to 3876325 Compare September 2, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants