Repository navigation
1.0.0 - Release
JsxCore 1.0.0
Write your ASP.NET Core views in TSX. Return them from a controller. Never install Node.
JsxCore is a real IViewEngine for ASP.NET Core that renders JSX and TSX. Preact ships inside
the package; React is one project-file property away. Server-render for first paint, hydrate in
the browser, or both, chosen per response. Your view models are C#, and their TypeScript types
are generated from them, so the two can't drift.
The .NET SDK is the only prerequisite.
Sixty seconds
dotnet add package JsxCorebuilder.AddJsxCore();
app.UseJsxCore();
app.MapGet("/", () => Results.Extensions.Jsx("Home/Index", new { name = "World" }));// Views/Home/Index.tsx
export default function Index({ model }: { model: { name: string } }) {
return <h1>Hello {model.name}</h1>;
}dotnet run.That's the whole setup.
What's in it
No Node. No npm. Not even a little. JsxCore talks to the npm registry itself, in C#. A clean checkout builds on a machine that has never had Node installed, it fetches the native TypeScript compiler and the esbuild binary and gets on with it.
No bundler. TypeScript rewrites ./Card.tsx to ./Card.js and the browser resolves the module graph natively. Nothing to configure, no import map to hand-write.
Views are components. The same component renders on the server for SEO and first paint, mounts in the browser for interactivity, or both. You pick per response.
Real .NET interop. Server rendering runs in-process, so a view calls your C# services synchronously, during render. No fetch, no API, no bridge.
Types generated from your C#. Describe a model once, in .NET. The .tsx gets the declarations.
Drops into MVC. return View() finds Index.tsx. Minimal APIs get Results.Extensions.Jsx.
Release builds precompile your views and publish them, so the server needs no compiler and no npm. Minified with esbuild, served Brotli or gzip.
Also shipping
JsxCore.Npm, a dotnet npm tool. Add, restore and list npm packages with nothing installed but the .NET SDK. It resolves versions, verifies integrity, and writes a package-lock.json that real npm accepts.
dotnet tool install --global JsxCore.Npm
dotnet npm add markedSupported
Built and tested on:
- .NET 8, 9 and 10. Linux, macOS and Windows.