Skip to content

Build a React or Vue front end against Sillo routes with sillo-inertia: server-side routing, no API layer, and no client-side router to keep in sync.

Inertia.js lets you write a React or Vue front end without building an API for it. Routes stay on the server, handlers return a component name and its props, and the client swaps the page without a full reload.

A handler names a component and returns its props:

@app.get("/dashboard")
async def dashboard(request: Request, response: Response):
return await render("Dashboard", {"stats": {"signed_in_as": request.user.email}})

The component receives them as props:

export default function Dashboard({ stats }: Props) {
return <p>Signed in as {stats.signed_in_as}</p>
}

There is no endpoint to define, no client-side fetch, no loading state, and no second description of the same data.

It is the middle path between Templating and Frontend (SPA): you get a real component-based front end, but routing, authorisation and data loading stay in Python, where the rest of your application already is.

RoutingData reaches the page byYou also maintain
TemplatingServerTemplate contextNothing
InertiaServerProps, with the pageComponents
SPAClientfetch from an APIComponents, a router, an API

Choose Templating when the page is mostly content. Choose a SPA when something other than your own front end consumes the API, a mobile client, a partner integration. Choose Inertia when you want components and there is exactly one consumer.

Your handler is the same either way. What the response is gets decided by the request:

  • First visit. A browser navigation. The response is the full HTML shell with the page object embedded, so the document has a title and content before any JavaScript runs.
  • Every navigation after: an XHR carrying X-Inertia. The response is the page object as JSON, and the client swaps it into the page already open.

This is why Inertia pages are excluded from the OpenAPI document. A GET /login that returns an HTML document to a browser and a JSON page object to Inertia is not an API endpoint, and describing it as one (“Successful Response”, application/json) is worse than not describing it at all.

Support lives in a separate package, so nothing here is carried by applications that do not use it.

Terminal window
uv add sillo-inertia

The starter has it wired already, along with Vite, React, Tailwind and a working auth flow. Starting there is the shortest path to a running page.