Skip to content

chore: update nestjs to v12 - #528

Open
tsang-bot[bot] wants to merge 1 commit into
developfrom
renovate/major-nestjs
Open

tsang-bot[bot] wants to merge 1 commit into
developfrom
renovate/major-nestjs

Conversation

@tsang-bot

@tsang-bot tsang-bot Bot commented Jan 17, 2025

Copy link
Copy Markdown
Contributor

ℹ️ Note

This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@nestjs/common (source) 10.4.2212.0.3 age adoption passing confidence
@nestjs/common (source) ^10.0.0^10.0.0 || ^12.0.0 age adoption passing confidence
@nestjs/common (source) ^8.0.0 || ^9.0.0 || ^10.0.0^8.0.0 || ^9.0.0 || ^10.0.0 || ^12.0.0 age adoption passing confidence
@nestjs/config 3.3.012.0.0 age adoption passing confidence
@nestjs/config ^3.0.0^3.0.0 || ^12.0.0 age adoption passing confidence
@nestjs/platform-express (source) 10.4.2212.0.3 age adoption passing confidence
@nestjs/schematics 10.2.312.0.3 age adoption passing confidence
@nestjs/testing (source) 10.4.2212.0.3 age adoption passing confidence

Release Notes

nestjs/nest (@​nestjs/common)

v12.0.3

Compare Source

v12.0.3 (2026-09-15)
Bug fixes
Dependencies
Committers: 4

v12.0.2

Compare Source

v12.0.2 (2026-09-14)
Bug fixes
Enhancements
Dependencies
Committers: 16

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: '[email protected]' });

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.

v11.2.5

Compare Source

What's changed

Full Changelog: nestjs/nest@v11.2.4...v11.2.5

v11.2.4

Compare Source

What's changed
  • fix(microservices): handle unserializable patterns without crashing
  • fix(platform-fastify): absolute-form request target middleware bypass

v11.2.3

Compare Source

What's Changed

Full Changelog: nestjs/nest@v11.2.2...v11.2.3

v11.2.2

Compare Source

What's changed

v11.2.1

Compare Source

What's Changed

Full Changelog: nestjs/nest@v11.2.0...v11.2.1

v11.2.0

Compare Source

What's Changed
New Contributors

Full Changelog: nestjs/nest@v11.1.29...v11.2.0

v11.1.29

Compare Source

What's Changed
New Contributors

Full Changelog: nestjs/nest@v11.1.28...v11.1.29

v11.1.28

Compare Source

v11.1.28 (2026-07-08)
Bug fixes
  • core
    • #​17239 fix(core): trigger teardown of SSE producer Observable on client disconnect with interceptor (@​jyx-07)
  • common
  • websockets
Enhancements
Dependencies
Committers: 4

v11.1.27

Compare Source

What's Changed

Full Changelog: nestjs/nest@v11.1.26...v11.1.27

v11.1.26

Compare Source

What's Changed

Full Changelog: nestjs/nest@v11.1.25...v11.1.26

v11.1.25

Compare Source

What's Changed
New Contributors

Full Changelog: nestjs/nest@v11.1.24...v11.1.25

v11.1.24

Compare Source

v11.1.24 (2026-05-25)
Bug fixes
Enhancements
Dependencies
Committers: 2

v11.1.23

Compare Source

v11.1.23 (2026-05-21)
Bug fixes
  • core
    • #​16998 fix snapshot: true eagerly instantiates Terminus transient indicators since 11.1.20
Committers: 1

v11.1.22

Compare Source

v11.1.22 (2026-05-21)
Bug fixes
Enhancements
Committers: 2

v11.1.21

Compare Source

v11.1.21 (2026-05-14)
Bug fixes
Committers: 1

v11.1.20

Compare Source

v11.1.20 (2026-05-13)
Bug fixes
Enhancements
Dependencies
Committers: 13

v11.1.19

Compare Source

v11.1.19 (2026-04-13)
Bug fixes
Committers: 2

v11.1.18

Compare Source

v11.1.18 (2026-04-03)
Bug fixes
Dependencies
Committers: 6

v11.1.17

Compare Source

v11.1.17 (2026-03-16)
Enhancements
Bugs
  • platform-fastify
    • auto-run middleware for HEAD requests as fastify redirects them to GET handlers (effectively skipping middleware execution) cbdf737 (@​kamilmysliwiec)
Dependencies
Committers: 3

v11.1.16

Compare Source

v11.1.16 (2026-03-05)
Bug fixes
  • microservices
Dependencies
Committers: 2

v11.1.15

Compare Source

What's Changed
New Contributors

Full Changelog: nestjs/nest@v11.1.14...v11.1.15

v11.1.14

Compare Source

v11.1.14 (2026-02-17)
Bug fixes
Enhancements
Committers: 5

v11.1.13

Compare Source

v11.1.13 (2026-02-03)
Bug fixes
  • common
Enhancements
Dependencies
  • platform-fastify
  • platform-express
    • #​16241 fix(deps): update dependency cors to v2.8.6 ([@​renova

Important

✂ PR body was truncated to here.


Configuration

📅 Schedule: (in timezone Europe/London)

  • 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 has been generated by Mend Renovate CLI.

@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch from 428473b to 1ef22fb Compare January 18, 2025 02:10
@tsang-bot tsang-bot Bot changed the title chore: update nestjs to v11 (major) chore: update nestjs (major) Jan 18, 2025
@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch 7 times, most recently from 3b91225 to 75339e6 Compare January 23, 2025 13:24
@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch 5 times, most recently from 35c9292 to c7d314e Compare February 1, 2025 02:18
@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch 5 times, most recently from c837332 to ff03af2 Compare February 7, 2025 02:16
@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch 4 times, most recently from e4c3041 to e073e79 Compare February 14, 2025 13:24
@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch 4 times, most recently from 684cbd9 to 6174178 Compare February 24, 2025 13:26
@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch from 6174178 to e693c19 Compare February 26, 2025 02:20
@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch 5 times, most recently from 587f65d to f5fbeab Compare April 8, 2025 13:30
@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch 7 times, most recently from fc6e349 to 8711e96 Compare April 16, 2025 13:30
@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch 6 times, most recently from acabab3 to 17dcbc0 Compare April 23, 2025 13:30
@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch 5 times, most recently from fb35542 to 45f26c2 Compare May 2, 2025 13:32
@tsang-bot
tsang-bot Bot force-pushed the renovate/major-nestjs branch 4 times, most recently from 8ce1f13 to 521c765 Compare May 6, 2025 13:36
@tsang-bot

tsang-bot Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: package-lock.json
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @nestjs/[email protected]
npm ERR! node_modules/@nestjs/common
npm ERR!   @nestjs/common@"12.0.3" from the root project
npm ERR!   peer @nestjs/common@"^12.0.0" from @nestjs/[email protected]
npm ERR!   node_modules/@nestjs/platform-express
npm ERR!     @nestjs/platform-express@"12.0.3" from the root project
npm ERR!   3 more (@tsangste/nestjs-auth, @tsangste/nestjs-logger, @tsangste/nestjs-storage)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nestjs/common@"^10.0.0" from @nestjs/[email protected]
npm ERR! node_modules/@nestjs/core
npm ERR!   @nestjs/core@"10.4.22" from the root project
npm ERR!   peer @nestjs/core@"^10.0.0" from @tsangste/[email protected]
npm ERR!   libs/nestjs-auth
npm ERR!     @tsangste/[email protected]
npm ERR!     node_modules/@tsangste/nestjs-auth
npm ERR!       workspace libs/nestjs-auth from the root project
npm ERR!   2 more (@tsangste/nestjs-logger, @tsangste/nestjs-storage)
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /tmp/renovate/cache/others/npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/renovate/cache/others/npm/_logs/2026-09-16T17_33_47_212Z-debug-0.log

@tsang-bot

tsang-bot Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants