skip to content
Khalid Abuhakmeh logo Khalid Abuhakmeh

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.

19 min read

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.

Diagram: on the left, a dynamic app pays for routing, data access, and rendering on every request. On the right, a static site generator pays that cost once at build time and serves plain HTML files with no runtime cost.

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.

A timeline of static site eras: Jekyll with Liquid and Thor, 11ty, Frankenblog, Razor Engine experiments, Statiq, Astro, and Bevel, drawn as bevel-cut chips from left to right

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.

Diagram: your app (Program.cs), typed content under Data/, and Razor pages feed one model that either renders live in development or exports as plain HTML

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:

Diagram: files under Data/ go through a build-time data step into a typed ISiteData. Razor pages mapped with MapStatic read it and render live while developing, or as static files on export.

The fastest way to try it is with the Bevel.Templates package and dotnet new:

Terminal window
dotnet new install Bevel.Templates
dotnet new bevel-blog -n MyBlog
cd MyBlog
dotnet watch # live pages while you edit
dotnet 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:

A dark terminal window showing dotnet new install Bevel.Templates, dotnet new bevel-blog -n MyBlog, dotnet run -c Release – –bevel-build exporting 7 static files and 1 asset in 127 milliseconds, and the resulting wwwroot listing

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: Hello
date: 2026-12-03
authorId: khalid
tags: [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.

A dark terminal window showing dotnet build failing with error BEVEL092: the Summary member of the Posts dataset is still null after processors run, followed by a help link to the Bevel diagnostics page

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.

Diagram: the data step reads files, binds them to records, runs processors that can remove items, then applies OrderBy, Unique, references, and groups, and writes a snapshot

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:

The Bevel Conf 2027 home page on a cream background with a yellow See the schedule button, a bordered Add to your calendar button, and cards for five speakers The Bevel Conf 2027 schedule page listing Wednesday, May 12 sessions in cards with times, rooms, titles, speaker links, and short descriptions

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.

The Bevel docs home page with the headline Razor in. Plain HTML out., Get started and Follow the tutorial buttons, a terminal snippet, and a diagram of a Razor page and a Markdown file becoming a static index.html

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.

Bar chart of requests per second for one 10 KB post page on a 1,000-post Bevel site at 64 connections. Bevel serving its export: 125,411 requests per second, p50 0.45 milliseconds, p99 1.63 milliseconds. Live Razor render: 18,481 requests per second, p50 3.2 milliseconds, p99 10.15 milliseconds. Live plus OutputCache: 117,340 requests per second, p50 0.53 milliseconds, p99 1.3 milliseconds.

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.

Bar chart of pages generated per second on export. 100 posts: 122 HTML pages in 0.31 seconds, 392 pages per second. 1,000 posts: 1,202 HTML pages in 0.68 seconds, 1,770 pages per second. 10,000 posts: 12,002 HTML pages in 4.2 seconds, 2,860 pages per second.

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).

Bar chart of Markdown size on disk versus compiled app DLL size, with cold build time. 100 posts: 1.0 MB Markdown, 1.2 MB DLL, cold build 2.4 seconds. 1,000 posts: 9.9 MB Markdown, 11.0 MB DLL, cold build 2.7 seconds. 10,000 posts: 100.8 MB Markdown, 110.8 MB DLL, cold build 6.2 seconds.

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.

Bar chart of dotnet build time in seconds. 100 posts: no-op 0.44 seconds, after editing one post 1.54 seconds. 1,000 posts: no-op 0.59 seconds, after editing one post 1.76 seconds. 10,000 posts: no-op 2.02 seconds, after editing one post 5.65 seconds.

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.

Bar chart of peak resident memory in MB. 100 posts: cold build 240 MB, export 132 MB. 1,000 posts: cold build 265 MB, export 167 MB. 10,000 posts: cold build 1,202 MB, export 557 MB.

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:

Terminal window
DOTNET_gcServer=0 dotnet run -c Release -- --bevel-build

A 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 new templates, 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:

  1. Run dotnet new install Bevel.Templates.
  2. Read the Quickstart, then the rest of the docs.
  3. 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.

Comments

Related Posts