Skip to main content
zerotal

Documentation


Documentation / @zerotal/inertia

@zerotal/inertia

The Inertia.js adapter for Zerotal — build React or Vue single-page apps with no separate API layer.

Controllers return `inertia('PageName', props)` instead of JSON or HTML: on a full page load the adapter renders the HTML shell, and on subsequent visits it returns a JSON page object that the Inertia client swaps into the current page component. Shared props expose global data (the authenticated user, flash messages) to every page, the optional/lazy/defer prop helpers control what is sent on partial reloads, and SSR renders the first paint on the server.

Examples

Return an Inertia page from a controller

import { inertia } from "@zerotal/inertia";

export async function index(ctx) {
  const users = await User.query().get();
  return inertia("Users/Index", { users });
}

Share global props at boot

import { share } from "@zerotal/inertia";

share("appName", () => config("app.name"));

Remarks

Register InertiaProvider. React consumers need react/react-dom; Vue consumers need vue/@inertiajs/vue3 (declare whichever you use). Requires Bun ≥ 1.1.

Other

Props