Jamstack: what and why?
In a nutshell, Jamstack technology enables building websites that deliver excellent performance.
Jamstack is a new way of building websites and apps that deliver better performance, higher security, lower cost of scaling, and a better developer experience" Jamstack.org
Key features of a Jamstack architecture are:
- excellent performance
- cheap and easy to scale
- better security
- outstanding developer experience
In the next sections we zoom in on each feature.
To understand why Jamstack delivers excellent performance we compare it to a traditional web architecture.
Traditionally the web-browser or client performs a request to the web server to load a webpage. Upon this request the Web Server pulls the requested content for the webpage from the Content Management System (CMS). And at last step the CMS looks up the required data in its Database. As you can see each step involves a on-demand pull-based request and naturally each (network) request requires time to complete.
Let's now look at the Jamstack approach. Again the client performs a request to load a webpage, but this time it contacts a Content Delivery Network (CDN). Upon request the CDN directly serves the requested webpage to the client. It does not need to generate the page as the page was generated and pushed at build time from the Headless CMS to the CDN.
Pushing webpages at build-time instead of pulling content at run-time enables delivering excellent performance.
Cheap and easy to scale
Jamstack serves webpages from a CDN. A CDN is a geographically distributed network of servers that is build for performance and high availability. As a CDN is geographically distributed webpages are served from the nearest server to the client. By using a CDN you leverage the performance of a distributed network instead of doing your own scaling as is the case for a traditional solution.
Because Jamstack builds the pages once and serves pre-build pages from a CDN the required computation power is much less compared to a traditional approach where pages are calculated on-demand. This makes is your website cheap to scale.
As Jamstack based websites are rendered at build time the possible attack surface gets smaller. This is because a CDN only serves pre-build static pages and there is no CMS server running where you need to handle the security for.
There are of course dynamic aspects on your website that require runtime APIs. For these APIs you have two options: (1) use a SaaS-based service or (2) build your own API.
By using a SaaS-based service you leverage the expertise for a certain domain from a vendor and handling the complexity of security is done by the vendor. Although there is very large SaaS landscape, there is probably some domain specific code or integration glue you need to build yourself. The amount of code to write is however much less compared to traditional solution where you extend the CMS. Writing only a small number of custom APIs greatly reduces your security risks.
Outstanding developer experience
Jamstack is strongly associated with other terms like Headless technology, microservice based architecture, static website generation, Content Delivery Network (CDN), Application Delivery Network (ADN), and the API Economy. There a lot of terms to learn when you are new to it.
Want to learn more about Jamstack?
Some good websites that describe Jamstack are:
- https://jamstack.org - the original Jamstack promotion website by Netlify
- https://jamstack.email - mailinglist with curated Jamstack content