@dudousxd/nestjs-inertia (core)
pnpm add @dudousxd/nestjs-inertiaThe heart of the system. Implements the Inertia.js protocol as a NestJS module.
Key API surface
Section titled “Key API surface”| Export | Description |
|---|---|
InertiaModule.forRoot(options) | Registers the module globally; sets root view, version, and shared props |
InertiaModule.forRootAsync(options) | Async variant (useFactory, useClass, useExisting) |
InertiaModule.forFeature(options) | Registers an additional scope with its own view/shared props |
@Inertia(component) | Method decorator — intercepts return value, renders Inertia response |
@UseInertia(scope) | Controller/method decorator — selects a forFeature scope |
InertiaService | Injectable service for programmatic renders and redirects |
Inertia.always(fn) | Prop marker — always resolved, even on partial reloads |
Inertia.optional(fn) | Prop marker — resolved only when explicitly requested |
Inertia.defer(fn, group?) | Prop marker — deferred to a separate request |
Inertia.merge(fn, opts?) | Prop marker — appended/prepended on reload |
InertiaAuthGuard | Removed — see auth-redirect recipe |
InertiaNotFoundFilter | Removed — see not-found recipe |
ErrorBagInterceptor | Namespaces errors by X-Inertia-Error-Bag header |
CsrfCookieInterceptor | Sets XSRF-TOKEN cookie and validates X-XSRF-TOKEN |
Minimal forRoot options
Section titled “Minimal forRoot options”InertiaModule.forRoot({ rootView: 'inertia/root.html', // path to HTML shell (relative to cwd) version: '1', // asset version for cache-busting})See the Getting Started guide for a full bootstrap example.