loading...

What makes a site JAMstack?

shortdiv profile image Divya ・2 min read

You may notice that the JAMstack isn’t really a new concept. Developers have been building static sites that leaned on JavaScript for decades. So what differentiates a JAMstack site from a traditional static one? For starters, the JAMstack is a methodology rather than an outcome. You could say that a JAMstack site is a static site but a static site is not necessarily a JAMstack one. To understand this distinction, it’s worth examining the build process of a JAMstack site as opposed to a strictly static one.

A JAMstack site is characterized by content living in a git repo alongside code and templates. This allows them to follow a generate-deploy cycle where a site is rebuilt each time a content or code change is made. Because of the git based workflow, every change is a valid commit to git and by extension deploys are immutable. The ability to revert is a key distinguishing factor of the JAMstack. In the past, it was commonplace to deploy sites via FTP, which meant your server and files within it were mutated with each new deploy. Mutable deploys present a host of challenges. These include ever changing and unpredictable server environments and issues with invalid caches. JAMstack sites do away with this by taking advantage the ability for modern CDNs to invalidate your cache completely.

Though JAMstack sites generally include JavaScript, API and prebuilt markup, a site doesn’t need to have every one of these elements to be considered JAMstack. The JAMstack is a direct response to the growing complexities of building for the web and strives for a return to simplicity. It does this by taking advantage of modern build tools, developments in the CDN space (hello edge compute) and a growing API ecosystem to outsource complex functionality. The JAMstack is effectively a movement away from servers. A site can therefore be considered JAMstacks when this architecture is embraced and browsers are given free rein to run the show.

For more on what makes a site "JAMstack", check out the comprehensive guide to the JAMstack published by O'Reilly Media

Posted on by:

shortdiv profile

Divya

@shortdiv

Tea drinker in a coffee drinking world

Discussion

markdown guide
 

"The JAMstack is effectively a movement away from servers."

Nonsense. You call an API you use a server. You have an HTML page, there is a server.

No dynamic server-side rendering seems to be the real idea.

 

The JAMstack ethos of moving away from servers, is similar to how serverless doesn't mean no servers. What this approach pushes for is a movement away from dynamically rendering content on a server and instead hosting content statically from a CDN. In that regard, it's a movement away from the traditional way of serving content server-side. So yes, you're right in that last sentence.

Also to your comment on HTML pages still living on servers, there is a distinction between a CDN and a web server. A CDN is about speeding up the access/delivery of your website’s assets to users by having a distributed network of edge servers. This is done by having your content live on the server as cached static assets. This is in contrast to traditional servers where 100% of content is rendered on the fly for every single request. Not only does this require a full round trip to the origin server to serve content, it also takes far longer depending on the user's latency and bandwidth.

 

Divya is right here but I think it's largely a problem of the term "serverless" being a bit of a misnomer, which kind of confused me when I first started looking into this methodology.

Yes, it's not SERVERLESS but really what you're not doing is investing in a dedicated server to run your web apps; instead of having to manage your server you're leveraging SERVICES like GitHub, Netlify and AWS to host, build and operate your site.

For me, having had to run websites with a LAMP stack for pretty much all of my career, not having to worry about DevOps and being able to leverage the kind of continuous deployment that you get with GitHub and Netlify is a breath of fresh air - as yet there are specific, really heavy use instances where I can see I'd want to go back to building a site with, say, Wordpress, but there have been many instances in the past where Wordpress and the associated infrastructure required has felt heavy and expensive for simple websites; the Jamstack ideology makes building and deploying such sites an absolute doddle.