Installation
Install nestjs-inertia packages with pnpm, npm, or yarn, and understand peer dependencies.
Install core + Vite
pnpm add @dudousxd/nestjs-inertia @dudousxd/nestjs-inertia-vite
pnpm add -D @dudousxd/nestjs-codegen @dudousxd/nestjs-inertia-codegen-extensionnpm install @dudousxd/nestjs-inertia @dudousxd/nestjs-inertia-vite
npm install --save-dev @dudousxd/nestjs-codegen @dudousxd/nestjs-inertia-codegen-extensionyarn add @dudousxd/nestjs-inertia @dudousxd/nestjs-inertia-vite
yarn add -D @dudousxd/nestjs-codegen @dudousxd/nestjs-inertia-codegen-extensionHTTP adapter
NestJS defaults to Express. If you use Fastify, install the Fastify adapter instead.
Express (default)
pnpm add express
pnpm add -D @types/expressnpm install express
npm install --save-dev @types/expressyarn add express
yarn add -D @types/expressFastify
pnpm add fastify @fastify/cookie @nestjs/platform-fastifynpm install fastify @fastify/cookie @nestjs/platform-fastifyyarn add fastify @fastify/cookie @nestjs/platform-fastifyPeer dependencies
| Peer dep | Required by | Condition |
|---|---|---|
@nestjs/common >=10 | core | always |
@nestjs/core >=10 | core | always |
express >=4 | core | Express adapter (default) |
fastify >=4 | core | Fastify adapter |
vite >=5 | vite | build pipeline |
@nestjs/testing >=10 | testing | test suites |
typescript >=5 | @dudousxd/nestjs-codegen | CLI static analysis |
@dudousxd/nestjs-codegen >=0.1 | codegen extension | typed-client codegen host |
@inertiajs/react >=1 | codegen extension | provides the router for navigate() |
Optional packages
Install only what you need.
# Typed HTTP client + <Link> components
pnpm add @dudousxd/nestjs-inertia-client
# Test helpers (expectInertia, InertiaTestingModule)
pnpm add -D @dudousxd/nestjs-inertia-testingnpm install @dudousxd/nestjs-inertia-client
npm install --save-dev @dudousxd/nestjs-inertia-testingyarn add @dudousxd/nestjs-inertia-client
yarn add -D @dudousxd/nestjs-inertia-testingEngine requirements
All packages require Node.js >= 20 (>= 20.19 when running NestJS 12). NestJS 10, 11 and 12 are all supported.
@dudousxd/nestjs-inertia >= 1.4.4 for streaming responses
InertiaMiddleware runs on every request matched by its route registration — not just Inertia renders — and patches the response object to suppress writes after headers are sent. Versions before 1.4.4 gated res.end() on res.headersSent, which swallowed the final end() call on streaming responses (SSE, NDJSON, file downloads) that flush headers before streaming the body. The connection would then hang until the client/proxy idle timeout (ERR_HTTP2_PROTOCOL_ERROR behind an ALB). If your app serves any streaming HTTP responses alongside Inertia pages, pin @dudousxd/nestjs-inertia to >= 1.4.4.