Building a modern alternative to Salesforce, powered by the community.
Find a file
Félix Malfait 5dfb66917c
Upgrade NestJS from 10.x to 11.x (#15836)
## Overview
This PR upgrades all NestJS dependencies from version 10.x to 11.x,
following the [official migration
guide](https://docs.nestjs.com/migration-guide). This builds on top of
the v9 to v10 upgrade completed in PR #15835.

## Changes

### Dependencies Updated
**Core packages (10.x → 11.x):**
- `@nestjs/common`: 10.4.16 → 11.0.8
- `@nestjs/core`: 10.4.16 → 11.0.8
- `@nestjs/platform-express`: 10.4.16 → 11.0.8
- `@nestjs/config`: 3.2.3 → 3.3.0
- `@nestjs/passport`: 10.0.3 → 11.0.0
- `@nestjs/axios`: 3.0.2 → 3.1.2
- `@nestjs/schedule`: ^3.0.0 → ^4.1.1
- `@nestjs/serve-static`: 4.0.2 → 5.0.1
- `@nestjs/cache-manager`: ^2.2.1 → ^2.3.0
- `@nestjs/jwt`: 10.2.0 → 11.0.0
- `@nestjs/typeorm`: 10.0.2 → 11.0.0
- `@nestjs/terminus`: 11.0.0 (already on v11)
- `@nestjs/event-emitter`: 2.1.0 (compatible)

**DevDependencies:**
- `@nestjs/testing`: ^10.4.16 → ^11.0.8
- `@nestjs/schematics`: ^10.1.0 → ^11.0.2
- `@nestjs/cli`: 10.3.0 → 11.0.0

### Code Changes
**Fixed: TwentyConfigModule conditional imports**
- Updated `TwentyConfigModule.forRoot()` to use spread operator for
conditional imports
- Fixes TypeScript error with NestJS 11's stricter DynamicModule type
checking

**Cleanup: Removed unused package**
- Removed `@revertdotdev/revert-react` (not being used anywhere in the
codebase)

## Breaking Changes Addressed

### 1.  Reflector Type Inference
- **Impact**: None - codebase only uses `reflector.get()` method
- **Analysis**: Does not use `getAllAndMerge()` or `getAllAndOverride()`
(the methods with breaking changes)
- **Files reviewed**: feature-flag.guard.ts,
message-queue-metadata.accessor.ts,
workspace-query-hook-metadata.accessor.ts

### 2.  Lifecycle Hooks Execution Order
- **Change**: Termination hooks (`OnModuleDestroy`,
`BeforeApplicationShutdown`, `OnApplicationShutdown`) now execute in
REVERSE order
- **Analysis**: Reviewed all lifecycle hook implementations
  - Redis client cleanup
  - Database connection cleanup (GlobalWorkspaceDataSource)
  - BullMQ queue/worker cleanup
  - Cache storage cleanup
- **Result**: Dependency order is safe - services using connections
clean up before the connections themselves

### 3.  Middleware Registration Order
- **Change**: Global middleware now executes first regardless of import
order
- **Analysis**: Middleware is not registered as global, so execution
order remains consistent
- **Files reviewed**: app.module.ts, middleware.module.ts

## Testing

All tests passing and build successful:

**Unit Tests (283+ tests):**
-  Health module: 38 tests passed
-  Auth module: 115 tests passed (passport v11 integration)
-  REST API: 90 tests passed (middleware and express platform)
-  Feature flags: 17 tests passed (Reflector usage)
-  Workspace: 23 tests passed

**Build & Quality:**
-  Type checking: Passed
-  Linting: Passed
-  Build: 3,683 files compiled successfully

## Verification

Tested critical NestJS functionality:
-  Authentication & Security (JWT, OAuth, guards)
-  HTTP Platform (Express integration, REST endpoints)
-  Dependency Injection (Services, factories, providers)
-  Cache Management (Redis with @nestjs/cache-manager)
-  GraphQL (Query runners, resolvers)
-  Configuration (Environment config)
-  Scheduling (Cron jobs with @nestjs/schedule v4)
-  Lifecycle Hooks (Module initialization and cleanup)
-  Reflector (Metadata reflection in guards)

## Related PRs
- #15835 - Upgrade NestJS from 9.x to 10.x (completed)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Upgrades NestJS to v11 and updates routing patterns, auth strategies,
GraphQL schema options, and build/dist paths (scripts, Docker, Nx,
migrations, assets), plus enables Devtools in development.
> 
> - **Backend (NestJS 11 upgrade)**:
> - Bump `@nestjs/*` packages (core, platform-express, jwt, passport,
typeorm, serve-static, schedule, cli/testing/schematics) to v11.
> - Update REST/route-trigger/file controllers to new wildcard syntax
(`*path`).
> - Refactor OAuth (Google/Microsoft) and SAML strategies (abstract base
+ explicit `validate`); minor typings.
>   - Enable `DevtoolsModule` in development.
> - **GraphQL**:
> - Add `buildSchemaOptions.orphanedTypes` for client-config types; keep
Yoga/Sentry setup.
> - **Build/Runtime & Config**:
> - Standardize dist layout (remove `src` in paths): update scripts,
Docker `CMD`, Nx `project.json`, render scripts, TypeORM migration
paths, asset resolution.
> - Adjust `nest-cli.json` (watchOptions, asset globs, migrations
outDir, monorepo/root).
> - Improve config module imports (spread conditional); tsconfig
excludes `node_modules`.
>   - Minor Nx default: `start` target caching disabled.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
1139fd85a9. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-11-16 18:20:06 +01:00
.cursor Update changelog process to require user approval (#15760) 2025-11-11 16:50:04 +01:00
.github Upgrade NestJS from 9.x to 10.x (#15835) 2025-11-15 23:06:13 +01:00
.nx Add nxw.js file (#8362) 2024-11-06 14:24:07 +01:00
.vscode Consolidate Prettier config and improve consistency (#15191) 2025-10-18 12:24:35 +02:00
.yarn Update yarn and remove explicit hardened mode (#13092) 2025-07-08 14:57:08 +02:00
packages Upgrade NestJS from 10.x to 11.x (#15836) 2025-11-16 18:20:06 +01:00
tools/eslint-rules fix: Replace angle bracket placeholders with curly braces in docs to fix crowdin's tags mismatch errors (#15751) 2025-11-11 02:20:48 +05:30
.dockerignore register all cron jobs in entrypoint (#12791) 2025-06-23 21:05:01 +02:00
.gitattributes Consolidate Prettier config and improve consistency (#15191) 2025-10-18 12:24:35 +02:00
.gitignore fix(ai): improve mcp metadata logic (#13991) 2025-08-20 12:06:13 +02:00
.mcp.json Ability to navigate/scroll the workflow canvas with sliding two fingers (#14804) 2025-10-06 13:44:23 +02:00
.nvmrc Upgrade to Node 24 (#13730) 2025-08-07 17:02:12 +02:00
.prettierignore POC: chore: use Nx workspace lint rules (#3163) 2024-01-03 23:07:25 +01:00
.prettierrc Consolidate Prettier config and improve consistency (#15191) 2025-10-18 12:24:35 +02:00
.vale.ini Fix vale ci (#3353) 2024-01-10 17:05:23 +01:00
.yarnrc.yml i18n - translations (#13102) 2025-07-08 15:13:02 +02:00
CLAUDE.md Enhance role-check system with stricter checks (#15392) 2025-11-07 15:37:17 +01:00
crowdin.yml docs: localize navigation tabs and groups for supported locales (#15811) 2025-11-14 22:03:54 +01:00
eslint.config.mjs fix: Replace angle bracket placeholders with curly braces in docs to fix crowdin's tags mismatch errors (#15751) 2025-11-11 02:20:48 +05:30
eslint.config.react.mjs fix: Enable Lingui recommended rules and fix all translation violations (#14133) 2025-08-28 15:12:38 +02:00
jest.config.mjs Refactor read only object and fields (#13936) 2025-08-19 18:10:35 +02:00
jest.preset.js POC: chore: use Nx workspace lint rules (#3163) 2024-01-03 23:07:25 +01:00
LICENSE feat(sso): allow to use OIDC and SAML (#7246) 2024-10-21 20:07:08 +02:00
Makefile Refactor Makefile for streamlined service definitions (#14757) 2025-10-02 11:55:05 +02:00
nx Fix execution permissions (#11604) 2025-04-16 11:46:37 +02:00
nx.json Upgrade NestJS from 10.x to 11.x (#15836) 2025-11-16 18:20:06 +01:00
package.json docs: localize navigation tabs and groups for supported locales (#15811) 2025-11-14 22:03:54 +01:00
README.md Remove Hacktoberfest from README (#15530) 2025-11-03 10:03:03 +01:00
render.yaml Begin moving to postgres spilo + adding pgvector (#8309) 2024-11-15 09:38:30 +01:00
tsconfig.base.json Revert "[hacktoberfest] feat: add fireflies" (#15589) 2025-11-04 12:25:23 +01:00
yarn.config.cjs [ENHC] Create Yarn constraints to validate node version (#10542) 2025-02-27 15:18:07 +01:00
yarn.lock Upgrade NestJS from 10.x to 11.x (#15836) 2025-11-16 18:20:06 +01:00

Twenty logo

The #1 Open-Source CRM

🌐 Website · 📚 Documentation · Roadmap · Discord · Figma


Cover


Installation

See: 🚀 Self-hosting 🖥️ Local Setup

Does the world need another CRM?

We built Twenty for three reasons:

CRMs are too expensive, and users are trapped. Companies use locked-in customer data to hike prices. It shouldn't be that way.

A fresh start is required to build a better experience. We can learn from past mistakes and craft a cohesive experience inspired by new UX patterns from tools like Notion, Airtable or Linear.

We believe in Open-source and community. Hundreds of developers are already building Twenty together. Once we have plugin capabilities, a whole ecosystem will grow around it.


What You Can Do With Twenty

Please feel free to flag any specific needs you have by creating an issue.

Below are a few features we have implemented to date:

Personalize layouts with filters, sort, group by, kanban and table views

Companies Kanban Views

Customize your objects and fields

Setting Custom Objects

Create and manage permissions with custom roles

Permissions

Automate workflow with triggers and actions

Workflows

Emails, calendar events, files, and more

Other Features


Stack

Thanks

Chromatic Greptile Sentry Crowdin

Thanks to these amazing services that we use and recommend for UI testing (Chromatic), code review (Greptile), catching bugs (Sentry) and translating (Crowdin).

Join the Community