The modern jamstack.org approach for developing websites is primarily concerned with adopting the architecture yielding the best performance and superior UX by minimizing the time to first byte from serving pre-built static assets from CDN edge caches.
A consequence of designing your UI decoupled from your back-end server is that it also becomes considerably cheaper to host as its static files can be hosted by any web server and is a task highly optimized by CDNs who are able to provide generous free & low cost hosting options.
This template takes advantage of its decoupled architecture and uses GitHub Actions to deploy a copy of its static UI generated assets and hosted on:
GitHub Pages CDN
It's an optional but recommended optimization as it allows the initial download from your website to be served directly from CDN edge caches.
The .NET 6
/api backend server is required for this App's dynamic functions including the Hello API on the home page
and its built-in Authentication.
The C# project still contains the complete App and can be hosted independently with the entire App served directly from its deployed ASP.NET Core server at:
But when accessed from the CDN nextjs.jamstacks.net that contains a
copy of its static
/wwwroot UI assets, only its back-end JSON APIs are used to power its dynamic features.
Since hosting on GitHub Pages CDN is free, the only cost is for hosting this App's .NET Server which is being hosted from a basic $10 /mo droplet which is currently hosting 25 .NET Docker Apps and demos of starting project templates which works out to be just under $0.40 /mo!
Jamstack is quickly becoming the preferred architecture for the development of modern web apps with benefits that extend beyond performance to improved:
- Security from a reduced attack surface from hosting read-only static resources and requiring fewer App Servers
- Scale with non-essential load removed from App Servers to CDN's architecture capable of incredible scale & load capacity
- Maintainability resulting from reduced hosting complexity and the clean decoupling of UI and server logic
- Portability with your static UI assets being easily capable from being deployed and generically hosted from any CDN or web server
Best of all the Jamstack approach fits perfectly with ServiceStack's recommended API First Development model which encourages development of reusable message-based APIs where the same System APIs can be reused from all Web, Mobile & Desktop Apps from multiple HTTP, MQ or gRPC endpoints.