InertiaCore.AspNetCore 0.2.1

dotnet add package InertiaCore.AspNetCore --version 0.2.1
                    
NuGet\Install-Package InertiaCore.AspNetCore -Version 0.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="InertiaCore.AspNetCore" Version="0.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="InertiaCore.AspNetCore" Version="0.2.1" />
                    
Directory.Packages.props
<PackageReference Include="InertiaCore.AspNetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add InertiaCore.AspNetCore --version 0.2.1
                    
#r "nuget: InertiaCore.AspNetCore, 0.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package InertiaCore.AspNetCore@0.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=InertiaCore.AspNetCore&version=0.2.1
                    
Install as a Cake Addin
#tool nuget:?package=InertiaCore.AspNetCore&version=0.2.1
                    
Install as a Cake Tool

InertiaCore.AspNetCore

NuGet Downloads Build License

Inertia.js Adapter for ASP.NET Core

A production-ready ASP.NET Core adapter for building modern Inertia.js applications with .NET.

InertiaCore.AspNetCore provides a complete server-side integration layer for Inertia.js, enabling you to build modern monolithic applications using your preferred frontend framework while keeping the simplicity of server-side routing and controllers.

Supports:

  • ASP.NET Core MVC
  • ASP.NET Core Minimal APIs
  • Inertia.js v3
  • Vue, React, and other Inertia-compatible frontend frameworks

This project is based on the original InertiaCore project by Kacper Ziubryniewicz.


Why InertiaCore?

InertiaCore brings the Inertia.js server adapter experience to the .NET ecosystem.

It provides:

  • A complete Inertia request/response pipeline
  • Server-side rendering support
  • Lazy and async props
  • Shared application data
  • Validation error handling
  • Vite integration
  • Asset version management
  • Protocol-compliant redirects
  • Minimal API support

No separate API layer is required. Build your application with server-side routing and modern frontend components.


Features

Inertia.js v3 Support

✅ Full support for the latest Inertia.js v3 protocol.

Includes:

  • Inertia request detection
  • Version handling
  • Partial reloads
  • Lazy props
  • Shared props
  • Redirect handling
  • Error bag support
  • Response formatting

ASP.NET Core Support

Supported application styles:

✅ MVC Controllers

public IActionResult Index()
{
    return Inertia.Render("Dashboard");
}

✅ Minimal APIs

app.MapGet("/dashboard", () =>
{
    return Inertia.Render("Dashboard");
});

Validation Error Handling

Automatic validation handling using ASP.NET Core ModelState.

Features:

  • Automatic validation error collection
  • Named validation error bags
  • X-Inertia-Error-Bag support
  • Standardized string array error responses

Example:

{
  "errors": {
    "default": {
      "email": [
        "The email field is required."
      ]
    }
  }
}

Shared Data

Share data globally across all Inertia responses.

Example:

Inertia.Share("auth", new
{
    UserId = userId
});

or:

Inertia.Share(new Dictionary<string, object?>
{
    ["auth"] = new
    {
        UserId = userId
    }
});

Lazy and Async Props

Load expensive data only when required.

Example:

public IActionResult Index()
{
    return Inertia.Render("Posts", new
    {
        Posts = new LazyProp(async () =>
        {
            return await _context.Posts.ToListAsync();
        })
    });
}

Server-Side Rendering

Built-in support for Inertia SSR.

Enable SSR:

builder.Services.AddInertia(options =>
{
    options.SsrEnabled = true;
});

Configure your SSR endpoint:

builder.Services.AddInertia(options =>
{
    options.SsrUrl = "http://127.0.0.1:13714/render";
});

Vite Integration

Includes helpers for Vite-powered applications.

Register:

builder.Services.AddViteHelper();

Use in your layout:

@Vite.Input("src/main.ts")

React HMR support:

@Vite.ReactRefresh()

Asset Version Management

Flexible version resolution support.

Built-in providers:

  • Default static version provider
  • Delegate-based version provider
  • Custom provider implementations

Example:

builder.Services.AddInertia(options =>
{
    options.VersionResolver = () =>
    {
        return "1.0.0";
    };
});

Inertia Redirect Handling

Automatically handles Inertia-compliant redirects.

Supports:

  • GET redirects
  • POST redirects
  • PUT redirects
  • PATCH redirects
  • DELETE redirects

Non-GET requests automatically use 303 See Other.


Empty Response Handling

Empty responses from Inertia requests are automatically converted into redirects.

Handled scenarios:

return Ok();
return NoContent();

The adapter redirects users back to the previous page using:

  1. The Referer header
  2. Current request URL fallback

Installation

Install from NuGet:

Package Manager

Install-Package InertiaCore.AspNetCore

.NET CLI

dotnet add package InertiaCore.AspNetCore

Getting Started

Add Inertia services:

using InertiaCore.Extensions;

builder.Services.AddInertia();

Add middleware:

app.UseInertia();

Your application is now ready to serve Inertia responses.


Frontend Setup

Create your root view.

Example:

Views/App.cshtml

@using InertiaCore

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <title inertia>
        My Application
    </title>

    @await Inertia.Head(Model)
</head>

<body>

@await Inertia.Html(Model)

<script type="module" src="/src/main.ts"></script>

</body>
</html>

Backend Usage

Render an Inertia page:

public IActionResult Index()
{
    return Inertia.Render("Dashboard", new
    {
        User = user
    });
}

Configuration

Customize Inertia:

builder.Services.AddInertia(options =>
{
    options.RootView = "~/Views/App.cshtml";

    options.SsrEnabled = true;

    options.SsrUrl =
        "http://127.0.0.1:13714/render";
});

Example Applications

Example projects:


Roadmap

Upcoming improvements:

  • Additional Inertia protocol coverage
  • Improved developer tooling
  • More ASP.NET Core integrations
  • Additional examples and templates

Contributing

Contributions, issues, and feature requests are welcome.

Please open an issue or submit a pull request.


License

Licensed under the MIT License.

See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.1 71 6/30/2026
0.2.0 84 6/29/2026
0.1.0 103 6/23/2026
0.0.10 109 6/21/2026
0.0.9 98 6/16/2026