JAMstack? More like SHAMstack.

Avatar of Chris Coyier
Chris Coyier on

📣 Freelancers, Developers, and Part-Time Agency Owners: Kickstart Your Own Digital Agency with UACADEMY Launch by UGURUS 📣

I’m a fan of the whole JAMstack thing. It seems like a healthy web movement. I’m looking forward to both of the upcoming conferences.

I feel like the acronym might not be quite doing it justice though. Not that I suggest we change it. Once a thing like that has legs, I find it’s best to roll with it. Same deal with serverless. Heck, the name of this website is pretty… not great.

To me, the most important part of JAMstack is rooted in the concept of static file hosting. Static file hosting is the foundation of all the power. It opens up a bunch of doors, like:

  • Everything can be CDN-hosted. “The edge,” as they say. Even the HTML (the M in JAMStack also refers to Markup) can be CDN-hosted, which you otherwise can’t do. That gives you an amazing base of speed that encourages you to keep that speed as you build.
  • The project feels easier to work with. Git clone, npm install, build. Deployments are git pushes of a dist folder. It’s so cool, for example, Netlify gives you a URL for every build, even on branches you’re working on. This is made possible by deploys being kind of immutable. A set of files at a particular point in time.
  • Cloud functions are awesome. Because you don’t have a traditional server-side language to reach for, you build it with cloud functions when you do need server-side code — which is a cool way to architect things anyway and is very spiritually connected to all this.

Don’t think, “Oh, JAMstack is just for Jekyll blogs,” or whatever. True, static site generators are extremely JAMstack-y, and JAMstack highly encourages as much prebuilt markup as possible (which is good for speed and SEO and all that), but pre-built markup isn’t a requirement.

I’d go so far as to say that a client-side JavaScript-powered app that ships a <div id="root"></div> and a bundle of JavaScript that hits APIs and builds out the site is still a JAMstack site. It’s still statically hosted (probably) with cloud functions serving up data.

But as long as you’re JAMStack anyway, that encourages you to put more in those static files. In that way, it encourages static content as well, when possible. I’d say “server-side rendered” (SSR) as that’s the common term, but it’s beyond that. It’s not a server side language generating the markup on request; it’s built in a build step ahead of time, before deployment. Again it’s not required, just encouraged.

So, we’ve got static-hosted HTML, and all our other files (e.g. CSS, images, etc.) are also static. Then:

  • The J of JAMstack is JavaScript.
  • The A of JAMstack is APIs.

They are sorta kinda the same thing. Your JavaScript files are statically hosted. They run, and they talk to APIs if they need to. A common example might be a GraphQL endpoint coughing up some content.

An interesting twist here is that you can half-and-half this stuff. In other words, you can pre-build some of the markup, and wait for JavaScript and API calls for other parts. Imagine an e-commerce site with a homepage and a dozen other pages you can pre-build entirely, but then a catalog of thousands of products that would be too impractical to statically generate (too slow). They are just a single scaffolded template that flesh themselves out with client-side API calls.

So, if we were to make a new acronym, perhaps we’d include Static Hosting in there and combine the JavaScript and APIs into just APIs, leaving us with…

Static Hosting, APIs, and Markup, or the SHAMstack. Errrrr 😬 maybe not.