Monorepo for Inertia adapters and examples.
ring-inertia: Ring middleware for the Inertia v3 protocol.replicant-inertia: Replicant client adapter for Inertia.examples/client-react: React/Vite example client.examples/client-replicant: Replicant/shadow-cljs example client.examples/server-ring: Ring example server.
Run checks:
bb checkAll commands below are run from the repository root.
Start the React/Vite client sample:
bb client-react:install
bb client-react:devIn another terminal, start the Ring server sample:
bb server-ring:devOpen http://localhost:3000. Do not open the Vite dev server URL
http://localhost:5173 directly; it only serves the React assets, and the
Inertia page object is rendered by the Ring server.
Start the Replicant/shadow-cljs client sample:
bb client-replicant:install
bb client-replicant:devIn another terminal, start the Ring server sample with Replicant assets:
bb server-ring:dev-replicantOpen http://localhost:3000. Do not open the shadow-cljs dev server URL
http://localhost:5174 directly; it only serves Replicant assets, and the
Inertia page object is rendered by the Ring server.
Expected browser behavior:
- The initial
Homepage is served by Ring as HTML. - Adding a todo sends an Inertia
POSTto the Ring server and redirects back to the todo list. The React page uses Inertia'suseForm; the Replicant page uses thereplicant-inertianavigation helpers. The Ring sample parses the JSON request body. - Each todo can be completed, reopened, or deleted through Inertia
PATCHandDELETErequests. Open Aboutnavigates through an Inertia XHR request.Reload server timeperforms a partial reload forserverTime.PATCH then redirectsends an InertiaPATCHto Ring. The sample route intentionally returns302, and the middleware normalizes it to303.External redirectreturns409withX-Inertia-Location, then Inertia performs a browser-level visit to https://inertiajs.com.
Protocol-level checks:
curl -i http://localhost:3000/
curl -i -X POST -H 'X-Inertia: true' -H 'Content-Type: application/json' --data '{"title":"Write README"}' http://localhost:3000/todos
curl -i -X PATCH -H 'X-Inertia: true' http://localhost:3000/todos/3/toggle
curl -i -X DELETE -H 'X-Inertia: true' http://localhost:3000/todos/3
curl -i -H 'X-Inertia: true' -H 'X-Inertia-Version: dev' http://localhost:3000/about
curl -i -H 'X-Inertia: true' -H 'X-Inertia-Version: old' http://localhost:3000/about
curl -i -X PATCH -H 'X-Inertia: true' http://localhost:3000/messages
curl -i -H 'X-Inertia: true' http://localhost:3000/externalThe first command should return the initial HTML page. The todo mutation
commands should return redirects back to /. The About command should return
200 with X-Inertia: true. The stale-version command should return 409
with X-Inertia-Location. The redirect sample should return 303 with
Location: /. The external redirect sample should return 409 with
X-Inertia-Location: https://inertiajs.com.
- Inertia v3 protocol: https://inertiajs.com/docs/v3/core-concepts/the-protocol
- Inertia client setup: https://inertiajs.com/docs/v3/installation/client-side-setup
- Ring response helpers and response map conventions: https://ring-clojure.github.io/ring/ring.util.response.html
- Ring server adapter usage:
ring-inertia/README.md - Replicant: https://github.com/cjohansen/replicant
- Replicant client adapter usage:
replicant-inertia/README.md