When You Should Use JAMStack - And When You Shouldn't

December 4, 2020 · 2 min read
A fast biker. Background is city lights at night, blurred due to the high speed of biker
Photo by Luca Campioni on Unsplash

JAMStack is getting more and more popular. You've heard about it and are wondering whether you should use it for that next project.

The use cases for JAMStack become clearer when we take a short look at what JAMStack is and which benefits it brings.

JAMstack = client-side JavaScript, reusable APIs, and pre-built Markup

On the internet, you will find many (slightly different) definitions of JAMstack. For me, JAMstack means:

  • Pre-rendered HTML
    Most front-end frameworks offer server-side rendering by now. This means we can pre-render all static parts of an application, resulting in faster load times for the website visitor. But your site doesn't need to be only HTML and CSS. Your apps can first load their HTML and then hydrate into a fully functional React, Angular or Vue application.
  • Static hosting on a CDN
    CDNs store your web app data on a globally distributed cache, so your website visitors have maximum download speed and minimum latency. Most CDNs also do cache invalidation for you, so visitors always get the newest version.
  • Using APIs for dynamic content
    Dynamic in this context when content changes happen frequently and non-predictably, like with comments. APIs can mean to use external solutions like commento for website comments.

JAMstack is easy to get started:

  • Pick a Static Site Generator (SSG)
  • Use Git
  • Choose a CDN
  • Set up CI to build your site and push the update to your CDN on every commit

This is just for a basic JAMStack site. You can write your content in a Content Service and trigger a new build every time you update your content. You can even build a whole JAMStack ecommerce site.

When and Why Use JAMStack

So, when should you use JAMStack?

  • When you build a site with mostly static content. This content may be updated often, which leads to rebuilds and publishing on a CDN. This uses the speed benefits of static HTML and CDNs for SEO benefits (and to make your readers happy).
  • When you're a frontend dev and know that most of your functionality can be supplied by external APIs that you can buy or rent.
  • If you like to decouple your concerns between frontend and backend. This can be useful when you have multiple people working on a project.
  • If you want to get the absolute maximum of performance out of your site (at least regarding time to first contentful paint).

JAMStack is not a good choice:

  • When the project dev(s) have a “go-to” tech stack for the upcoming project.
  • If the client has strict requirements regarding the technology or hosting options used.
  • If you want to use frameworks like Ruby on Rails, Pheonix, Django, or Laravel.

Try It Out

As with most technology decisions, I suggest you try out building a small project with the JAMStack mindset before building something bigger.

But: only do this if you want to explore it or if you see benefits. If not, there's no point in trying this out and you should look for something that piques your interest.