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.
Cheaper Hosting
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.
/ui
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
nextjs.jamstacks.net
This is an optional deployment step which publishes a copy of your .NET App's /wwwroot
folder to this templates
gh-pages branch where it's automatically served from
GitHub Pages CDN at no cost.
It's an optional but recommended optimization as it allows the initial download from your website to be served directly from CDN edge caches.
/api
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:
Digital Ocean
nextjs-api.jamstacks.net
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.
Total Cost
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 Benefits
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
- Developer Experience with the major JavaScript frameworks at the forefront of amazing DX are embracing Jamstack in their dev model, libraries & tooling
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.