Shared authentication
The SPA is served by your .NET app, so it lives behind the same cookies, auth, and middleware as every other page.
Vite.NET is an ASP.NET Core library that integrates Vite SPAs with Razor Pages and MVC views. Instead of hosting your front end on a separate Node server and wiring up CORS, proxies, and a second deployment, your SPA is built by Vite and served directly by your .NET application.
It is the .NET analogue to integrations like Vite Ruby or the Laravel Vite plugin. It works with React, Svelte, Vue, and Solid.
Shared authentication
The SPA is served by your .NET app, so it lives behind the same cookies, auth, and middleware as every other page.
Shared static assets
Vite writes its build output into wwwroot, so the SPA’s assets are served by the same
static-file pipeline as the rest of your site.
Micro-frontends
Mount one SPA per page, or several SPAs across different pages, all inside one host — no Node micro-service mesh required.
A great dev experience
In development you get Vite’s dev server and hot module replacement; in production you get hashed, optimized bundles.
Vite.NET ships as a pair that work together:
| Package | Where | Purpose |
|---|---|---|
TechGems.ViteDotNet | NuGet (your ASP.NET Core app) | Registers the integration and provides the tag helpers that render your SPA into a Razor page. |
vite-dotnet | NPM (your SPA folder inside an ASP.NET Core app) | A Vite plugin that shapes the build output and emits the manifests the back end reads. |
The key idea in this version of Vite.NET is that the front end describes itself to the
back end. You no longer duplicate the entrypoint, container element id, or port in your
appsettings.json. Instead:
entrypoint and containerElementId (you pass them when you
register it) and detects whether the app is React.wwwroot describing the app.ReactApp/vite.config.ts appsettings: "ViteDotNet": "ReactApp" │ │ │ ViteDotNetPlugin("src/main.tsx", │ reads manifests from │ "root") │ wwwroot/ReactApp/ ▼ ▼ manifest.dev.json ─────────────────────► <dev-vite-scripts> (development) manifest.prod.json ─────────────────────► <prod-vite-scripts> (production)