Integrate Inertia.js with any modern Javascript runtime and server.
Full documentation is available at https://inertiaserver.mintlify.app
Inertia lets you build single-page apps without SPA complexity. You write server routes that return components from your client framework (React, Vue, Svelte). Inertia handles the routing and state management on the client side.
JavaScript backend ecosystem was lacking a frontend solution that is backend centered. Inertia protocol, while quite simple, requires you to write a lot of boilerplate code to get started.
inertia-server provides framework agnostic server tooling for Inertia.js. It makes interaction with the library type-safe, seamless, and more mature. Use a ready-made adapter for your framework of choice, or create your own. Test your application using your favourite testing library. inertia-server is here to help.
import { createInertia, prop, PageProps } from 'inertia-server';
const { definePage, createHelper } = createInertia({
version: '1.0.0',
render: (page) => renderToString(<Root page={page} />),
});
const homePage = definePage({
component: 'Home',
props: {
title: prop<string>(),
description: prop<string>().deferred(),
},
});
export type HomePageProps = PageProps<typeof homePage>;
// Server agnostic request handler, with integrations you don't need createHelper
const inertia = createHelper({ request });
return inertia.render(
homePage({ title: 'Welcome', description: () => 'Hello, World!' })
);
// On the client (react example):
import { PageProps } from 'inertia-server';
import type { HomePageProps } from './pages/home';
export function Page({ title, description }: HomePageProps) {
return <>
<h1>{title}</h1>
{description ? <p>{description}</p> : <p>Loading description...</p>}
</>;
}Contributions are more than welcome.
This monorepo uses bun, biome, and Changesets for versioning and changelog management. To start, clone the repository and run:
bun install
bun buildYou can now start exploring the examples or the core inertia-server package. To run the examples and docs, execute:
# Elysia example, best for testing visually
bun run dev
# Hono example, best for testing with a real server
bun run dev:hono
# Docs
bun run dev:docsWhen everything is running, pick up any nested README's and start working on what interests you. You coding agents are provided with the AGENTS.MD, so ask them for help ;)