Bevel: A Static Site Generator for ASP.NET Core
Bevel turns Razor components and typed Markdown, JSON, and YAML into plain HTML from an ASP.NET Core app. Why I built it, how it works, and benchmarks.
TL;DR: Bevel adds static pages to the ASP.NET Core app you already know. You write Razor components, drop your content in
Data/, and Bevel turns that content into typed C# at build time. Pages render live while you work, and one command exports plain HTML you can host anywhere. It’s pre-1.0, it needs .NET 10 or later, and it’s built for fun. Start with the Quickstart.
I’ve been making static sites for a long time, and I keep coming back to the same itch: I want to do it in C#. So I scratched it. Bevel is a static site generator (people shorten it to “SSG”) for ASP.NET Core, and this post is a long reference for what it is, why it exists, how it behaves, and where it’s the wrong tool.
Bevel is an option in .NET that leans on what .NET and C# are already good at, and it’s a thought experiment I wanted to see through. It doesn’t replace any other tool. If that sounds fun, keep reading. If you’d rather jump straight in, the Bevel docs are the main event.
Why are static sites a data-processing problem?
I think of a static site as a data-processing job. You have data right now, and you want to turn it into useful outputs while spending very few resources. The input is Markdown files, YAML, a JSON export, or a few C# loaders. The outputs are HTML, an RSS feed, a sitemap, a search index, or even a calendar.ics file.
All the cost happens at build time. When a visitor asks for a page, no code runs. The server hands over a file.
Bevel is built around that idea. Data goes in, loaders, processors, and Razor do the work once, and plain HTML comes out for any host.
My road through static sites
Bevel came after years of trying other tools. Here’s the short version, with the posts I wrote along the way.
- Jekyll, Liquid, and Thor. Jekyll was my static site generator of choice for years, with Liquid templates and Thor for scripting. I wrote about Thor commands for Jekyll and even a Liquid tag for Twitter shares. I loved how simple the output was.
- 11ty. Eleventy is fast and flexible, with a few surprises. I wrote down five critical things to know before working with 11ty.
- Frankenblog. A mix of .NET and Ruby, because I wanted C# in the pipeline. It’s all in supercharging blogging with Frankenblog.
- Razor Engine experiments. I generated outputs with the Razor engine and parsed Markdown front matter with C#. Those were the first steps toward the idea behind Bevel.
- Wyam and Statiq. I like Statiq, the successor to Wyam, and I appreciate the work Dave Glick put into it. Its pipeline and module model just wasn’t the mental model I wanted. I wanted to stay close to the ASP.NET Core and Razor pieces I use every day. Some people will prefer Statiq, and that’s great.
- Astro. This blog runs on Astro today. I even wrote about great .NET documentation with Astro Starlight and how to skip scheduled static site builds with GitHub Actions.
What are the .NET static site generator options?
There are several good ways to produce static HTML from .NET:
- Statiq (Wyam’s successor) is a mature, flexible static generation framework.
- Blazor static server-side rendering, plus a prerender or crawl script, gets you HTML from components you already have.
- Roll your own Razor rendering, which is what I did for a while.
Those are all valid. Bevel is another option, built around its own mental model.
How is Bevel different?
Bevel has one mental model, and it’s the one I happen to enjoy. Your site is an ASP.NET Core app. Content lives under Data/ and becomes typed C# data at build time. Razor components are your pages. MapStatic maps a route to a page. One export command writes the files.
I prefer this mental model. Other people prefer other ones, and that’s okay.
The elephant in the room: JavaScript and AI
If you don’t have an aversion to JavaScript, you’ll probably pick a tool from the JavaScript ecosystem. That’s a sensible choice. Those tools are mature, the ecosystem is huge, and AI models have trained on thousands of sites built with them. If you ask an agent today to one-shot a website, there’s a good chance you get Astro back.
Static generation has never been a .NET strength. Bevel doesn’t change that overnight, and it isn’t trying to. It’s a preference and a thought experiment: what would a static site generator look like if it were an ASP.NET Core app first? I think that’s a fun question, and I wanted to answer it with working code.
What is Bevel?
Bevel reads content under Data/ (Markdown, JSON, YAML, XML, or C# loaders) at build time and hands it to your Razor pages as typed C# data. Here’s the whole flow:
The fastest way to try it is with the Bevel.Templates package and dotnet new:
dotnet new install Bevel.Templatesdotnet new bevel-blog -n MyBlogcd MyBlogdotnet watch # live pages while you editdotnet run -c Release -- --bevel-build # static export into wwwroot/Here’s a real run of the install, create, and export steps, trimmed to the relevant lines:
Export with -c Release. A Debug build runs build-time code as Development, which keeps drafts. dotnet watch runs Debug, so drafts stay visible while you write.
What does a Bevel site look like in code?
A Bevel site is three things: a dataset, a page, and a route. Start with a content file and a record that describes it. The attribute names the dataset and points at the files:
---title: Hellodate: 2026-12-03authorId: khalidtags: [bevel, razor]---Hello **world**. This is a post.[DataSource("Posts", "./*.md", OrderBy = "Date desc, Title")]public sealed record BlogPost( [Unique(IgnoreCase = true)] string Slug, string Title, DateOnly Date, string[] Tags, [Reference("Authors")] Author Author, string RawMarkdown);When you build, Bevel generates an ISiteData interface with a typed Posts property. A page reads it with @inject:
@inject ISiteData Data@inject ISiteLinks Links<html><head><title>@Data.Site.Title</title></head><body> <h1>@Data.Site.Title</h1> <ul> @foreach (var post in Data.Posts) { <li><a href="@Links.To(post)">@post.Title</a> by @post.Author.Name</li> } </ul></body></html>Program.cs maps routes. One line gives you the home page, and another gives you one page per post:
var builder = WebApplication.CreateBuilder(args);builder.AddBevel();
var app = builder.Build();app.MapStatic<HomePage>("/");app.MapStatic<PostPage>("/posts/{Slug}", (ISiteData data) => data.Posts);app.Run();That’s the full loop. The Quickstart walks through it from an empty folder, and the Tutorial builds something bigger.
Why C#? Bevel’s philosophy
Bevel leans on five things that C# and .NET do well.
1. Typed content, checked at build time
Front matter becomes a C# record. If your content doesn’t fit the record, dotnet build fails and tells you which file. Here’s what happens when I delete summary: from a post whose record requires it. The build fails with error BEVEL092: the Summary member of the Posts dataset is still null after processors run, with advice to set it, default it, or make it nullable.
Most BEVELnnn diagnostics end with a help link (here, https://khalidabuhakmeh.github.io/bevel/reference/diagnostics/bevel092/), and the message names the file. A bad data file fails the build instead of a visitor’s request. The diagnostics reference lists them all.
That error came from the template’s very first post, hello-world.md. If you’re as fond of hello world as I am, there’s a Hello World shirt for that.
2. Razor components
There’s no new template language to learn. If you’ve written Razor components, you can write a Bevel page. Layouts, sections, and components work the way they do in the rest of ASP.NET Core.
One note: Bevel doesn’t render Markdown for you. It gives you the body as RawMarkdown, and you render it with your own Markdig setup, in a component or a processor. See the Markdown extensions recipe.
3. It’s just ASP.NET Core
Dependency injection, configuration, and middleware still apply. Plain Minimal API app.MapGet endpoints aren’t Bevel routes, so they’re never exported and always run live. The sample blog has a live /api/search sitting next to its static pages.
4. IDE tooling and refactoring
Because content is typed, your IDE helps, whether that’s JetBrains Rider, Visual Studio, or VS Code. Rename a property on BlogPost and every page that uses it follows. The compiler checks every property you use in a page, so a typo shows up before you publish, not after.
5. Data processing in C#
This is where the “static sites are a data problem” idea pays off. The data step reads files, binds them to records, runs your processors, then applies ordering, [Unique], references, and groups.
A processor computes a value at build time. Bevel ships none, so you choose the libraries. Here’s a word counter:
public sealed class WordCounter : IProcessor<string, int>{ public int Process(string text) => text.Split(' ', StringSplitOptions.RemoveEmptyEntries).Length;}
public sealed record BlogPost( string Slug, string RawMarkdown, [Process<WordCounter>(nameof(RawMarkdown))] int WordCount = 0);You also get references between datasets (authorId: khalid becomes the same Author instance everywhere), groups for tags and archives, and custom format readers if you want TOML or CSV. Read more on processors, references, and custom formats.
What can you build with Bevel? Tour the samples
The Bevel repo ships two samples. The Conference sample is a small event site with speakers, sessions, and a schedule:
Look at the “Add to your calendar” button. That links to /calendar.ics, which is a non-HTML output generated from the same session data with MapStatic("/calendar.ics", ...). A static site doesn’t have to be only HTML. That was one of my favorite parts to build.
The second sample is a full blog. The templates are based on it, so dotnet new bevel-blog gives you paging, RSS, and a sitemap.
The Bevel docs site is itself a Bevel site.
If you want to build something similar, the docs have recipes for a blog, tags and archives, a docs site, a search index, and syntax highlighting.
How fast is Bevel? Rough benchmarks
Time for numbers, with a big caveat: these are ballpark numbers, not science. I ran them on an Apple M4 Pro with 14 cores and 24 GB of memory, using .NET SDK 10.0.404 and Bevel 0.3.0 from NuGet. The content is generated Markdown posts of about 900 words each, built from the bevel-blog template, and every build, export, and server ran with DOTNET_gcServer=0. Each number comes from a single run (the inner-loop numbers are a median of three). The load generator, oha, ran on the same machine as the server, so absolute numbers are optimistic. Compare the rows with each other, not with your hardware.
Exported file vs live render vs OutputCache
I served one 10 KB post page from a 1,000-post site three ways: the Bevel app serving its own exported file, a live Razor render, and a live render with OutputCache. That’s 64 connections for 10 seconds per run, and every response was a 200.
Takeaway: the exported file served about 125,000 requests per second, a live render managed about 18,500, and OutputCache pulled the live page up to about 117,000.
So OutputCache gets most of the way to static speed. It still needs a host with CPU and memory running your app, though. The exported files can go on GitHub Pages, a CDN, or object storage, and none of them run your code. The live post page is a heavy render (a Markdown body, a layout, related cards), which is why the gap is as wide as it is. Even the slowest row handles far more traffic than a personal blog sees.
Pages generated per second
This is the export step on its own: dotnet bin/Release/net10.0/Blog.dll --bevel-build, timed as a whole process, including startup and loading every dataset. Home pages are paged at five posts each, so 10,000 posts produce 12,002 HTML pages.
Takeaway: a 1,000-post site exports in under a second, and 10,000 posts (about 12,000 pages) takes around four seconds, which is roughly 2,900 pages a second. The per-second rate climbs with size because startup is a fixed cost of 0.2 to 0.3 seconds that small sites can’t spread out.
How much content fits in an app?
Bevel reads Data/ at build time and compiles it into your app, so your content ends up inside the DLL. I wanted to see how far that goes. This chart compares Markdown on disk with the compiled DLL, plus cold build time (no bin/ or obj/, build servers off).
Takeaway: the Markdown goes into the app as-is, so a 10 MB blog becomes an 11 MB DLL, and 10,000 posts (about 100 MB of Markdown) cold-builds in roughly six seconds. That’s a 111 MB assembly, and I didn’t measure its startup time or the memory it needs when running. If your content is measured in hundreds of megabytes, this is the ceiling to think about.
Inner-loop build time
This is what you feel while writing. I used dotnet build in Release with warm build servers, and the edit case appends a line to one post in the middle of the list.
Takeaway: on a 1,000-post blog, a no-op build takes about 0.6 seconds, and editing one post and rebuilding takes under two. At 10,000 posts those grow to about two and six seconds. Under dotnet watch, the live render means you don’t rebuild to see a Markdown edit in the browser, but I didn’t measure that path.
Memory
Peak resident memory for the cold build and the export, taken from /usr/bin/time -l. The build numbers are the largest single process (MSBuild and the compiler run as child processes), not a sum.
Takeaway: a 1,000-post site builds in about 265 MB and exports in about 167 MB. At 10,000 posts you need roughly 1.2 GB to build and 560 MB to export, which is fine for a laptop or a CI runner.
The Web SDK turns on server GC, and an export is short-lived, so garbage piles up. The docs’ Performance page recommends setting DOTNET_gcServer=0 for exports and in CI:
DOTNET_gcServer=0 dotnet run -c Release -- --bevel-buildA few more caveats: the posts are generated lorem-style text with no images, the HTTP test used one page on one site, and other apps were running on the machine. Stress testing at 10,000 posts found and fixed scaling issues before 0.3.0, and the changelog has the details. The Performance page covers tuning.
AI-assisted, and iterated many times
Bevel is AI-assisted, and it took many rounds to get here.
I set the direction, judged the developer experience, measured, and sent it back for more rounds. The history shows it:
- It started as “Strop.” The first commit in the repo is “Initial import of Strop,” and a later commit is “Rename Strop to Bevel.” The name changed, and so did the design.
- The API went through 0.1, 0.2, and 0.3. 0.2 added the
dotnet newtemplates, and the changelog lists what changed in each release. - The docs site drove 0.3. I rebuilt the documentation with Bevel itself, and the problems I hit there became features: processor-reported diagnostics, post-export steps, a sitemap and robots helpers, and pluggable format readers.
- Stress testing led to more rounds. I generated 10,000 posts, measured, fixed what I found, and measured again.
In this case, AI assistance fits because the output is static HTML, so the stakes are low. This isn’t hot-path or mission-critical code, and for an exported site, a bug usually means fixing it and rebuilding. Live endpoints and live serving run real code, so they deserve the same care as any ASP.NET Core app. The goal is a great developer experience that produces good HTML, and I still want it bug-free. It’s a hobby side-project, but it could clearly run production workloads.
If something’s confusing, slow, or wrong, open an issue. I’d like to hear it.
When shouldn’t you use Bevel?
Base the decision on what your users need from the site. Bevel is the wrong fit when:
- You have a very large database. A static build wants data it can read once. Millions of rows that change constantly belong behind a query.
- You’re building a real-time app. If the page must show what happened a second ago, serve it live.
- The app is highly dynamic. Per-user dashboards and workflows need a server that responds to each request.
Plenty of apps mix both, and Bevel supports that. Static pages and live endpoints can share one app.
A hybrid app like that needs a host that runs .NET. Railway builds an ASP.NET Core project straight from its .csproj with no configuration, so it’s an easy place to try one. (That’s my referral link: you get $20 in credits, and I may earn a commission.)
Then there are the factual trade-offs:
- Bevel is pre-1.0, so APIs can change between minor versions.
- It needs .NET 10 or later.
- All content ships inside the assembly, so editing one post recompiles the snapshot.
- The ecosystem is much smaller than Astro’s or Hugo’s.
- There’s no JavaScript bundler or islands story.
- Bevel doesn’t render Markdown or ship an indexer. You wire up Markdig and something like Pagefind yourself.
What’s next for Bevel?
I have a short list. The changelog mentions a GitHub Pages workflow option for the templates. Until then, the docs have a GitHub Pages guide with a full workflow you can copy. Beyond that, I’m waiting to see what people build and where it hurts.
Mostly, it was fun. I got to build a thing I wanted, with a mental model I like, and learn a lot about what static generation asks of a .NET app along the way.
Try Bevel, and show me what you build
Here’s the whole path:
- Run
dotnet new install Bevel.Templates. - Read the Quickstart, then the rest of the docs.
- Star or watch the GitHub repo, and file issues with feedback. Criticism is welcome.
If you build a site with Bevel, I’d love to see it. Drop a link in the comments.
FAQ
What is a static site generator (SSG)?
A static site generator, often shortened to SSG, takes content and templates at build time and writes plain HTML files. A web server or CDN serves those files without running application code on each request. Static site generation is the process of producing those files.
Does .NET have a static site generator?
Yes, several options exist. Statiq is a mature framework, Blazor’s static server-side rendering can produce HTML, and Bevel is a static site generator that works as an ASP.NET Core app with Razor components and typed build-time data.
Can I host a Bevel site on GitHub Pages?
Yes. The export writes plain HTML, so any static host works. Set BevelOptions.PathBase for a project site that lives under /repo, and use the GitHub Pages guide for a complete Actions workflow.
How is Bevel different?
Bevel treats a site as an ASP.NET Core app. Content under Data/ becomes typed C# data at build time, Razor components are the pages, MapStatic maps routes, and one command exports the HTML. It’s one mental model that I enjoy, and other tools use different ones.
Why not just use OutputCache?
OutputCache and ResponseCaching reduce the cost of repeated requests, but they still need a running host with CPU and memory. Exported files can sit on GitHub Pages, a CDN, or object storage, with no app process at all.
Do I need Blazor interactivity or WebAssembly?
No. Bevel uses Razor components to render HTML at build time. The export is plain HTML, and the app doesn’t need a Blazor circuit or WebAssembly in the browser.
Around the web
Comments
Loading comments from GitHub Discussions…