@stratal/inertia
v0.0.26
Published
Inertia.js v3 server adapter for Stratal framework — server-driven React SPAs
Maintainers
Readme
@stratal/inertia
Inertia.js v3 server adapter for Stratal framework — build server-driven React SPAs on Cloudflare Workers.
Features
- InertiaModule — Drop-in Stratal module with
forRoot()/forRootAsync()configuration - Streaming SSR — React 19
renderToReadableStreamstreaming viacreateInertiaSsrApp, with configurable per-route disabling - Shared Data — Global shared props with static values or request-scoped resolvers
- @InertiaRoute Decorator — Convention-based Inertia page routes with auto-applied response schema
- Partial Reloads — Optional, deferred, and merge props for efficient data loading
- Quarry CLI Commands —
inertia:install,inertia:dev,inertia:build, andinertia:types
Installation
npm install @stratal/inertia
# or
yarn add @stratal/inertiaAI Agent Skills
Stratal provides Agent Skills for AI coding assistants like Claude Code and Cursor. Install to give your AI agent knowledge of Stratal patterns, conventions, and APIs:
npx skills add strataljs/stratal| Skill | Description |
|---|---|
| stratal | Build Cloudflare Workers apps with the Stratal framework — modules, DI, controllers, routing, OpenAPI, queues, cron, events, seeders, CLI, auth, database, RBAC, testing, and more |
Quick Start
Module setup
import { Stratal } from 'stratal'
import { Module } from 'stratal/module'
import { InertiaModule } from '@stratal/inertia'
@Module({
imports: [
InertiaModule.forRoot({
rootView: 'app',
entryClientPath: 'src/inertia/app.tsx',
sharedData: {
appName: 'My App',
},
}),
],
})
class AppModule {}
export default new Stratal({ module: AppModule })Controller with @InertiaRoute
import { Controller, type RouterContext } from 'stratal/router'
import { InertiaRoute } from '@stratal/inertia'
@Controller('/notes')
export class NotesController {
@InertiaRoute({ summary: 'List notes' })
async index(ctx: RouterContext) {
return ctx.inertia('notes/Index', { notes: [] })
}
}Streaming SSR
Enable SSR by pointing the module at a bundle that exports a streaming render:
InertiaModule.forRoot({
rootView: 'app',
ssr: { bundle: () => import('./inertia/ssr') },
})src/inertia/ssr.tsx (scaffolded by quarry inertia:install) uses
createInertiaSsrApp, which wires Inertia's App, head collection, and React 19's
renderToReadableStream — the shell flushes early and the body streams progressively:
import { createInertiaSsrApp } from '@stratal/inertia/ssr'
export const { render } = createInertiaSsrApp({
resolve: async (name) => {
const pages = import.meta.glob('./pages/**/*.tsx')
const page = await pages[`./pages/${name}.tsx`]?.()
if (!page) throw new Error(`Page not found: ${name}`)
return page
},
})There is no client-side fallback — an SSR failure surfaces as an error rather than
silently degrading. Skip SSR per route with ctx.withoutSsr() or globally with
ssr.disabled: ['admin/*'].
Documentation
Full guides and examples are available at stratal.dev.
License
MIT
