Introduction

Inertia.Net is a .NET 10 server adapter for Inertia.js v3. Build React, Vue and Svelte apps without a separate API.

Inertia.Net connects ASP.NET Core to the Inertia.js v3 client. Your endpoints return pages and props; the client renders them as React, Vue or Svelte components. The first visit is a normal HTML response, and later visits are Inertia requests that update the page without a full reload.

It is an adapter, not a framework. Routing, authentication, authorization, validation and persistence stay in ASP.NET Core. There is no separate JSON API to design and no client-side router to keep in sync.

How it works

  1. An endpoint chooses a page and its props

    Text
    app.MapGet("/", () => Render("Home", new InertiaProps
    {
        ["greeting"] = "Hello from .NET",
    }));
  2. Inertia connects it to a client component

    Text
    export default function Home({ greeting }: { greeting: string }) {
      return <h1>{greeting}</h1>
    }
  3. The client updates the page

    The first request returns HTML with the page object embedded. Inertia links and form submissions request the next page in the background and swap the component while the browser keeps its state.

Your .NET app still owns the request. The adapter adds the protocol middleware, prop resolution, redirect semantics, flash data and asset tags.

What you get

Feature matrix

Minimal APIMVC controllersFastEndpoints
PackageInertia.NetInertia.Net + Inertia.Net.MvcInertia.Net + Inertia.Net.FastEndpoints
Render / Back / LocationRender(...) returns IResultsame, return IResult from an actionSend.InertiaAsync(...) or return the result
Validation redirect with errors.WithInertiaValidation()ModelState filter (global)c.UseInertia() pre-processor
Precognition.WithInertiaPrecognition()not availablec.UseInertia()
Razor root viewno (app.html template)optional (tag helpers)no (app.html template)
Native AOTyesno (MVC itself is not AOT)yes (with the FastEndpoints source generator)

The client packages are @inertiajs/react, @inertiajs/vue3 and @inertiajs/svelte, all version 3. Inertia.Net does not support v2 clients.

This documentation site

This site is an Inertia.Net app. The sidebar, search, docs pages and theme switcher are React components rendered by an ASP.NET Core Minimal API. Navigation uses Inertia links, and the source is in docs/Inertia.Net.Docs so it doubles as a real example.

Requirements

  • .NET 10 SDK
  • Node.js and npm to build the frontend (at runtime only when SSR is enabled)
  • An Inertia.js v3 client package for React, Vue or Svelte

Starting from scratch?

Use the starter template: dotnet new install Inertia.Net.Templates, then dotnet new inertia -n MyApp --framework react. It includes working pages, a form with validation, flash messages, CSRF and Vite configuration.

Next steps