How fast do you want your site to be?
Performance, Security, Scalability. You can now use these benefits of Jamstack sites in plain .NET Core.
What is Jamstack
Jamstack is an architecture for building fast and scalable websites. The content and templates are mixed together using a static site generator which pre-generates all pages of the site. Jamstack site is then typically hosted on a CDN to ensure easy and cheap availability and scalability.
What is Statiq
Statiq is currently the only static site generator for .NET.
Jamstack on .NET with Statiq
|How do you store classes?||Model classes||Model classes|
|How do you implement business logic?||Controller + additionallibraries||Pipeline + additional libraries|
|How do you implement website views?||Razor views||Razor views|
|How do you typically get the data?||Traditional CMS, database, API||Headless CMS, database, API|
|What framework do you use?||.NET Framework, .NET Core||.NET Core, .NET 5|
|What IDE do you use?||Visual Studio, VS Code||Visual Studio, VS Code|
Traditional or headless CMS
The architecture of Jamstack encourages you to separate concerns. To decouple content from business logic and presentation layer. The website content is typically stored in a cloud-based headless CMS. You don't need to care about hosting or updates, only ask API for the data you want.
The headless CMS Kentico Kontent is the only one that is fully integrated with Statiq, the static site generator for .NET.
Static files can be placed on a CDN. Content Delivery Network hosting is cheaper and allows for better availability and scalability. By replicating your data in multiple locations it brings your data closer to your visitors.
await Bootstrapper .Factory .CreateWeb(args) .DeployToAzureAppService( "MySiteName", "MyUsername", Config.FromSetting<string>("ENV_VAR") ) // ... .RunAsync();
dotnet run -- deploy
Propagating changes to Jamstack site
Whenever you change content or code, the Jamstack site needs to rebuild. The rebuild happens on a build server and is triggered automatically using a webhook notification.
For example, GitHub sends a webhook every time you push. A headless CMS sends a webhook every time you publish a content item.
How to start
dotnet new console --name FromZeroToHero
dotnet add package Statiq.Web -v 1.0.0-*
Get your content from a headless CMS or another data source.
Implement your markup in Razor views