Advanced Site Rendering Patterns on the Jamstack

Rate this content
Bookmark

In this session, I'll go over these patterns (Sharding, ISR, DPR, DSG) and show our viewers and 2million+ other Jamstack developers how to leverage them to build large sites without the overhead on lengthy build times.

This talk has been presented at Vue.js London Live 2021, check out the latest edition of this JavaScript Conference.

FAQ

JAMstack is a modern web development architecture based on client-side JavaScript, reusable APIs, and prebuilt Markup. It improves website performance by pre-rendering pages during the build process, ensuring that users receive content instantly without server-side processing delays, leading to faster load times and a better user experience.

The benefits of using JAMstack include faster site loading times, improved security due to reduced server-side dependencies, better SEO as content is pre-rendered and readily available to search engines, and simplified scaling by serving static content from a CDN.

Large JAMstack sites can face long build times due to the need to pre-generate numerous pages. Solutions to this include incremental builds, which rebuild only changed pages, and splitting a large site into microsites to manage builds more efficiently. Additionally, techniques like Incremental Static Regeneration (ISR) can generate pages on-demand rather than at build time.

ISR is a technique used in JAMstack to optimize build times. It allows developers to regenerate only the new or updated pages instead of rebuilding the entire site. This significantly reduces build times and improves site update efficiency by focusing on changed content only.

JAMstack handles dynamic content and user interactions through APIs and serverless functions. While static content is prebuilt and served directly from a CDN, dynamic interactions are managed by fetching data from APIs or executing serverless functions, allowing for real-time user experiences without compromising performance.

While JAMstack offers several advantages, there are trade-offs such as the complexity of managing large builds, potential stale content due to caching strategies, and the need for developers to adapt to a predominantly static site architecture. Additionally, some advanced dynamic functionalities might require more complex setups involving serverless functions and APIs.

Ekene Eze
Ekene Eze
23 min
21 Oct, 2021

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Today's Talk discusses advanced site rendering patterns in the JAMstack, including the benefits and challenges of using this approach. It explores solutions like incremental builds, microsites, and incremental static regeneration to improve build times and performance. The Talk also introduces distributed persistent rendering and Gatsby v4 as new solutions to enhance static site generation and server-side rendering.

1. Introduction to JAMstack Rendering Patterns

Short description:

Hello. Today I'll be talking about advanced site rendering patterns in the JAMstack. You will learn how rendering works, the pros and cons of rendering patterns, and how to improve performance. Building the JAMstack way solves the problem of slow loading times by processing requests at build time. However, there are trade-offs to consider.

Hello. Thank you very much for the introduction. Of course, my name is Ekene Eze, and today I'll be talking about advanced site rendering patterns in the JAMstack. Well, I'll get to my introduction just in a minute. Yes, so I work as a developer experience engineer at Netlify and I have a YouTube channel where I make video tutorials about web development. If you want to follow me on socials, I'm on Twitter, at Ekene underscore IO. Let's jump into it.

Okay, we're not jumping into it quite yet because I'd like to also tell you that outside being a developer experience engineer and doing my thing on YouTube and learning JavaScript and doing work with it, what I really want to do is be a mixologist so that I can get all my friends drunk for no reason at all. That's probably a story for a different But eventually, I will get to tell the story. And I hope you all are here to hear it when that happens. But I will go on and get started for today.

So what you will learn today is how rendering works on the jumpstack. If you've been building jumpstack applications with Knox or with any other framework, in your static sites generator, you will better understand how rendering works. You will also understand the pros and cons of some of the rendering patterns we have, what they bring to the table and what trade offs they also bring. Finally, you will also learn what to do when your jumpstack site is performing poorly. For instance, if it's taking like too long to build, you'll understand why that is happening and the things you can do to help speed up that process. But before we dive into it, let's take a trip back memory lane to understand why this is even important in the first place.

All right. So before now, what happens is when a user comes to your site and requests for products. And in this case, I mean, what I mean is if a user comes to your website and they click on products, ideally what happens is a request goes off to your server and depending on your server architecture and how it's configured. This request could go through your load balancers, your web servers, your application servers, and databases and all of that thing that goes on behind the scenes to serve that request. So ideally, this goes out, your server processes the request, produces the right contents, and sends it back to the user. While all that is going on behind the scenes, of course your user will be seeing either a blank screen or a loading screen or a spinner, depending on how you build your site. So this is not very good for the developer and not also very good for the user who is using the application because they get to stay at a blank screen or a loading screen for a while before the actual contents get served. But building the JAMstack way kind of like helps us solve that problem, and it solves it this way, right? All of that processing happens before the site goes live. So for instance, if you've built your JAMstack application, once you run the build command, what happens is the static site generator goes off and makes all the requests on your behalf, right? And generates all the pages, generates all the dynamic routes and all the parts that will be available in your application. And then the content is now served to your users. So what happens now is instead of users coming to your site and clicking buttons to make requests, all of those requests happens at build time so that when your users come to the site, all the contents they need are readily available. So there's no lags, there's no waiting time, there's no loading spin-outs going on forever. So this is a good way, but as you can imagine, like every solution, like everywhere that technology comes with a solution, they also have some trade-offs.

2. Benefits of JAMstack

Short description:

The benefits of using the JAMstack way include faster site speed, improved user experience, better SEO, and enhanced security through CDN deployment. Developers can focus on their core skill sets without worrying about infrastructure.

But before we talk about the trade-offs, the benefits we get from using the JAMstack way is that your site is faster and your users are happy. I mean, right? If you don't ever have to wait on loading screens to fetch content, or if you're visiting a site and you're seeing that it's fast, if you click a button, everything happens as it should without any lags, your users will be happy. As a user, I would be happy, right? And then you also get better SEO out of the box as the developer or as the owner of the site, all your sites is being, all the content of your site is readily available. So Google and all the search engines will be happy. They can crawl and index your site properly because all the contents is available ahead of time. And also deploying on the CDN means you have limited point of attack. So it's more secure because you only have to worry about your site and the CDN. You don't have to worry about securing your databases, your load balancers, your web servers, and all of those things, you just have to care about your own application and then the CDN does the rest for you. Building this way also enables developers to stay within their core skill sets. I mean, I see myself as a front end developer. I like building with Vue.js and Nox.js. I don't ever want to have to worry about how load balancers or containers or Docker works, right? And building this way kind of like helps me just stay within my skill set and not worry about those things that I'm not comfortable with by default.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

RedwoodJS: The Full-Stack React App Framework of Your Dreams
React Summit Remote Edition 2021React Summit Remote Edition 2021
43 min
RedwoodJS: The Full-Stack React App Framework of Your Dreams
Top Content
Redwood JS is a full stack React app framework that simplifies development and testing. It uses a directory structure to organize code and provides easy data fetching with cells. Redwood eliminates boilerplate and integrates Jest and Storybook. It supports pre-rendering and provides solutions for authentication and deployment. Redwood is a cross-client framework that allows for building web and mobile applications without duplicating work.
A Saga of Web Rendering Woes
Vue.js London 2023Vue.js London 2023
28 min
A Saga of Web Rendering Woes
This Talk discusses the problems faced in building and rendering web applications, different rendering methods and strategies, and the benefits of the Yamstack architecture. It covers server-side rendering, static site generation, incremental static regeneration, and edge rendering. The speaker demonstrates how to build a static site using a Hello CMS and the JAMstack architecture. Other topics include connecting Storyboard with a Nuxt application, mock data, hybrid rendering, and handling I18N with a static site generator.
How do Localise and Personalize Content with Sanity.io and Next.js
React Advanced 2021React Advanced 2021
8 min
How do Localise and Personalize Content with Sanity.io and Next.js
Sanity.io provides a content platform for structured content that replaces traditional CMS. Their solution allows businesses to structure and query content anywhere using the Sanity studio and open source React application. The talk focuses on solving the challenge of sending personalized data to users in a static website environment using Next.js Vercel for hosting and Sanity for content querying and delivery. The Sanity studio allows for modeling pages, articles, and banners, with banners being shown to visitors based on their country. The solution involves using Grok queries to fetch the right banner based on country information, demonstrating personalization based on localization and dynamic content querying.
Keeping It Simple
React Summit Remote Edition 2021React Summit Remote Edition 2021
9 min
Keeping It Simple
React brought simplicity to building browser-based applications, but as new concepts like context, hooks, server components, and streaming are introduced, it's important to know the current state of the application. The JAMstack simplifies reasoning about the state of web properties through immutable assets and atomic deploys. However, as the JAMstack evolves, challenges arise in areas such as build times and API caching for large projects, especially e-commerce.
API-first Development with Headless WordPress
React Summit Remote Edition 2021React Summit Remote Edition 2021
33 min
API-first Development with Headless WordPress
This Talk discusses API-first development with headless WordPress, highlighting its benefits and the availability of resources. It explores the use of plugins and frameworks like WPGraphQL and the headless framework from WP Engine to create custom post types and make GraphQL calls. The Talk also covers building websites, querying and caching data, deploying apps with the Atlas platform, and improving user experience. It touches on authentication, efficiency, backend resources, and WooCommerce integration in headless WordPress, as well as WordPress accessibility and SEO optimization.
Incremental Static Regeneration: Static Sites on Steroids
React Advanced 2021React Advanced 2021
22 min
Incremental Static Regeneration: Static Sites on Steroids
Incremental static regeneration is a feature in Next.js that allows for static generation on a per-page basis without rebuilding the entire site. It helps with headless content management systems and persists between deployments. The example demonstrates how server-side rendering, static site generation, and incremental static regeneration work together. The real-time visual editor allows for immediate changes to be seen. Visit the NetJS website for an e-commerce demo and learning platform.

Workshops on related topic

Crash Course into the Jamstack with Next.js & Storyblok
React Day Berlin 2022React Day Berlin 2022
161 min
Crash Course into the Jamstack with Next.js & Storyblok
WorkshopFree
Arisa Fukuzaki
Chakit Arora
2 authors
You might have read already about Jamstack. You probably already used Next.js, and recently you may be hearing a lot about the headless CMSs. This quick course will put all the pieces together and show you why Storyblok, combined with Next.js, is the best combo for your next project. Stop by and try it yourself!
- In-depth Jamstack knowledge. How it changed from old times to the modern world. Learn how Jamstack was created by comparing Static Sites and Dynamic Sites.- How Next.js serves content, and how content is served with Static Site Generation (SSG).- Atomic design methodology, and how this is applied to the content management system.- Hands-on project experience by building a Jamstack project with Next.js and Storyblok.
Prerequisites- Any Text . Visual Studio Code recommended- Node.js LTS- NPM or Yarn- GitHub account- Vercel account- Familiarity with JavaScript, React, and Git. Having worked with Next.js before is a plus
What's included1. Introduction and overview of the workshop2. Introduction to Jamstack3. Introduction to Atomic Design4. Overview of Headless CMS5. Introduction to Storyblok6. Next.js app creation7. Storyblok space creation8. Next.js and Storyblok connection9. Custom components creation10.First-page creation11. Introduction to Visual 12. Dynamic pages addition13. Blog section creation14. Deployment on Vercel
E-commerce on the Jamstack with NextJS and Netlify
React Summit Remote Edition 2021React Summit Remote Edition 2021
120 min
E-commerce on the Jamstack with NextJS and Netlify
Workshop
Nick DeJesus
Nick DeJesus
Jamstack frameworks are changing the way we build top-of-the-line experiences on the web. They are performant, secure and enable developers to build web apps faster than before. In this workshop, Nick DeJesus will walk you through what it's like to build an e-commerce site using NextJS, use-shopping-cart and theme-ui. You will learn how serverless functions with Netlify to help you make secure transactions and how to build accessible UI components that extend use-shopping-cart's abilities.
Jamstack eCommerce 101
JSNation Live 2021JSNation Live 2021
199 min
Jamstack eCommerce 101
Workshop
Bolaji Ayodeji
Bolaji Ayodeji
Digital commerce has changed, and there is an increasing demand for faster and kite efficient solutions. In this workshop, you'll learn about the evolution of ecommerce and how Jamstack and headless commerce evolves shopping experiences on the web. We will explore the basics of headless commerce building a minimal Jamstack ecommerce product page with static content, HTML5, CSS, and Javascript. Finally, we will integrate Commerce Layer for headless commerce capabilities and deploy our application to Netlify.