As a software developers, we often find ourselves navigating the vast universe of available tools and libraries, each promising to solve a particular problem or improve productivity. But what happens when the existing solutions don't quite fit your vision or specific use case? What if you crave more flexibility and control over your content rendering?
For me, the answer was clear: create something that has already been built countless times by other developers.
And so, Astra came to be. In fact, it is powering this very website using flat markdown files and Blazor Server. Stay tuned for an API backed Blazor WebAssembly example of this site as well!
Traditional static site generators often rely heavily on template logic. They're fantastic tools that serve their purpose, but they can sometimes feel restrictive, especially when you need to adapt them to unconventional projects or workflows.
While many developers are familiar with at least one language, having to master the intricacies of a template language or system can pose an additional learning curve.
Astra is different. It provides a comfy API to work with your markdown files, and it's written in C#, so you can use it in your existing code-base to create content rendering solutions that perfectly suit your needs.
To start working with Astra in Blazor Server out of the box, simply call the extension method.
Load your files from disk. I chose at startup, but you can do it whenever you want.
using (var serviceScope = app.Services.CreateScope())
var serviceProvider = serviceScope.ServiceProvider;
var astra = serviceProvider.GetRequiredService<IDataProvider>();
And then, just start using it!
<RecentArticles Posts="posts" />
private IEnumerable<AstraPost> posts;
protected override async Task OnInitializedAsync()
.Where(x => x.PublishDate > DateTime.MinValue)
Disclaimer: Work in progress
You'll start to appreciate my disclaimers. With armchair architects lurking around every corner, you do what's necessary to survive. Needless to say, this is still very early in its development. We're currently at the "make it work" stage. Refactoring and public scrutiny can come later.
Astra: An Opinionated Library
Astra is a library, not an application. It doesn't prescribe a certain way of doing things or force you into a specific template logic. Instead, it gives you the toolset you need to create content rendering solutions that perfectly suit your requirements.
Astra is designed to work with markdown files, whether they reside on your local disk, in a database, or in a Git repository. This approach opens up a whole new world of possibilities. You can create a headless API, build a dynamic blog, a newsletter system, or even a CMS. The only limit is your imagination.
While conceptualizing Astra, I was intent on crafting a lightweight library rather than an application. If executed correctly, Astra should be capable of enabling a diverse range of applications, each tailored to unique use cases.
This strategy promises unmatched flexibility, unshackled by the restrictions of a specific application or framework. Instead, you're bestowed with the liberty to construct something that's a perfect fit for your needs.
Astra is in its infancy. It's still a work in progress and I'm actively working on open-sourcing it and pushing it to GitHub. Here's what's on the roadmap:
- Create a basic static engine
- Refactor the bad code (light here, we might reconsider design after beta release)
- Add missing unit tests
- Publish to GitHub
- Add support for custom metadata
- Add supporting models (authors, tags, etc.)
- Publish beta NuGet
- Design the v1 API
Astra is an opinionated solution to content rendering written with .NET Core. It's not for everyone. But, it could be for you.