Inertia is a bridge between AdonisJS and React. You keep server-side routing and controllers, while the client swaps page components without full reloads.
1. Server-Driven Pages
Controllers render Inertia responses with props:
return ctx.inertia.render("users/show", { user: new UserDto(user) });
2. No Client-Side Routing
Routes live in start/routes.ts. Inertia intercepts links and form submissions, making XHR requests and swapping components.
3. DTOs for Props
Props are sent to the client. Use DTOs to control the shape and avoid leaking fields.
4. Validation at the Edge
Validate on the server with VineJS. Let the validator throw and let Inertia handle the errors.
- Set up Inertia in AdonisJS
- Create a new page/component
- Build a form with validation
- Debug an Inertia issue
- Something else
Then read the matching workflow from workflows/ and follow it.
- Does the page render? Check for
X-Inertia response header
- Are props received?
console.log(usePage().props)
- Does navigation work? Links should not full-reload
- Do forms submit? Check Network tab for XHR requests
- Are errors displayed? Trigger validation failure
// Frontend debug
console.log(usePage().props);
Report to the user:
- "Inertia response: ok"
- "Props received: X keys"
- "Navigation: SPA mode ok"
All in references/:
Core: setup.md, responses.md, forms.md, validation.md
Data Flow: shared-data.md, links.md
Quality: testing.md
Cookbook: cookbook.md
All in workflows/:
| File |
Purpose |
| setup-inertia.md |
Install and configure Inertia for AdonisJS |
| create-page.md |
Build new pages with props |
| build-form.md |
Forms with validation and useForm |
| debug-inertia.md |
Find and fix Inertia issues |
|
|
1---2name: inertia-adonisjs3description: Build AdonisJS 6 + Inertia.js (React) applications from scratch through production. Full lifecycle - setup, pages, forms, shared data, debugging.4---56<essential_principles>7## How Inertia + AdonisJS Works89Inertia is a bridge between AdonisJS and React. You keep server-side routing and controllers, while the client swaps page components without full reloads.1011### 1. Server-Driven Pages1213Controllers render Inertia responses with props:1415```ts16return ctx.inertia.render("users/show", { user: new UserDto(user) });17```1819### 2. No Client-Side Routing2021Routes live in `start/routes.ts`. Inertia intercepts links and form submissions, making XHR requests and swapping components.2223### 3. DTOs for Props2425Props are sent to the client. Use DTOs to control the shape and avoid leaking fields.2627### 4. Validation at the Edge2829Validate on the server with VineJS. Let the validator throw and let Inertia handle the errors.30</essential_principles>3132<intake>33**What would you like to do?**34351. Set up Inertia in AdonisJS362. Create a new page/component373. Build a form with validation384. Debug an Inertia issue395. Something else4041**Then read the matching workflow from `workflows/` and follow it.**42</intake>4344<routing>45| Response | Workflow |46|----------|----------|47| 1, "setup", "install", "start", "new" | `workflows/setup-inertia.md` |48| 2, "page", "component", "create", "render" | `workflows/create-page.md` |49| 3, "form", "validation", "submit", "useForm" | `workflows/build-form.md` |50| 4, "debug", "fix", "error", "not working" | `workflows/debug-inertia.md` |51| 5, other | Clarify, then select workflow or references |52</routing>5354<verification_loop>55## After Every Change56571. **Does the page render?** Check for `X-Inertia` response header582. **Are props received?** `console.log(usePage().props)`593. **Does navigation work?** Links should not full-reload604. **Do forms submit?** Check Network tab for XHR requests615. **Are errors displayed?** Trigger validation failure6263```ts64// Frontend debug65console.log(usePage().props);66```6768Report to the user:69- "Inertia response: ok"70- "Props received: X keys"71- "Navigation: SPA mode ok"72</verification_loop>7374<reference_index>75## Domain Knowledge7677All in `references/`:7879**Core:** setup.md, responses.md, forms.md, validation.md80**Data Flow:** shared-data.md, links.md81**Quality:** testing.md82**Cookbook:** cookbook.md83</reference_index>8485<workflows_index>86## Workflows8788All in `workflows/`:8990| File | Purpose |91|------|---------|92| setup-inertia.md | Install and configure Inertia for AdonisJS |93| create-page.md | Build new pages with props |94| build-form.md | Forms with validation and useForm |95| debug-inertia.md | Find and fix Inertia issues |96</workflows_index>