Site icon

2022 Dev Trends – Headless websites are go!

2022 – The Year of Headless?

Don’t worry, we are fully aware that Halloween has passed and no, this blog post has nothing to do with Sleepy Hollow. This post is much more mind numbingly awesome than that. It’s about Headless Websites and how they are set to take off in 2022.

A Headless website is one that uses WordPress or other Content Management Systems to store content but relies on a single page application built on a javascript framework to serve the front end of the website to the user.

Headless websites have been on our radar for some time now, however until recently they were out of reach for the average small- and medium-sized business. In the past few years, however, the cost of entry into the Headless universe has dropped substantially making it a more attainable yet still adventurous undertaking for some businesses.

More and more we are seeing savvy clients ask about Headless sites, or point to Headless sites as examples of work they like. In particular, the performance of Headless sites is hard to argue with if you rely on a speedy website for your business needs. These sites might still be out of reach for most customers because of the need for a hefty development budget at the outset of a project. Increasingly, Headless sites are becoming a viable option for those who have specific needs that are not being met within the existing WordPress or other CMS themes.

I asked our Dev team for their thoughts on some of the technologies that are helping to make 2022 the year of Headless. Here’s what they had to say.


Shalaw Karim is one of our newest developers. He brings to the team past experiences working with React, Gatsby, WordPress and Strapi. He had this to say about React and Gatsby:

Why React, and why Gatsby?

In conventional websites like WordPress, if you click on a link, whether for a new page or a form, it sends an HTTP request to the server, which means every time we want to see something new, we have to wait for server response, that takes time, and often servers are not as responsive as we expect them to be. To solve this, often websites depend on JS libraries like Ajax, but for one thing, it is too much work, and often without much result as Ajax calls in WordPress should go through the hurdles of being authenticated through WordPress backend, and the structure of conventional websites are built to work with incoming, outgoing requests. This model is called Server-side rendering, because rendering any content requires calls to the server and possibly database. 

React is a framework where it simply makes a virtual clone of your website (virtual DOM), and updates that clone through JS (not incoming or outgoing HTTP requests). It saves a blueprint of your website and handles changes (state update). Thinking about it, when you go to another page in React, you have not gone anywhere as far as the server is concerned, you are on a single page, working on a clone of your website. This model is called Client-side Rendering (CSR), because while the server is necessary, Javascript handles everything in the frontend. React also does data prefetching (when you open home-page, any link on home page will be fetched, like other pages, but not links inside them, like single posts), just to make it more user-friendly. Code splitting is another feature where you can make reusable components and write much fewer lines of code to achieve the same result.

– Then why Gatsby? React takes a blueprint of your current DOM tree, and handles everything through JS, that’s much faster than PHP, Ruby or Python, but not as fast or convenient or even secure as current business needs require. To solve that, the GatsbyJS team has made this framework on top of React where instead of a JS-handled clone, you have static HTML, CSS pages of your website. This is the oldest, but the fastest you can get with current technology as it’s simply a markdown with styles and some JS functions. The immediate question would be how GatsbyJS handles dynamic changes, for that, Gatsby produces the final result where thousands of static pages, with the latest data are built into them as if the data is static, minute by minute you can update and rebuild, so you wouldn’t want to be worried about the latest change in your backend.

Gatsby can deal with any sort of change, data update, form request, email, etc. There are some edge cases where you have to use the Server-side rendering model, where the requests from the user have certain changes that require server validation that can be handled with SSR, which Gatsby now provides.

It is more secure because what you have is pure HTML and CSS, and has nothing to do with database or server. You only need the database and server when you run build command. If you take the server down entirely later, the website will be functional and working correctly because the last version of your data is already integrated with your HTML and served statically. If the server is down, you can’t update it naturally, but it works with the last update, while with the conventional model, once the server is down, everything is down. This model is called Static-site Generation (SSG), and while there are many libraries and frameworks for this, Gatsby is the most popular.

Gatsby is also a hybrid model, because you can literally do SSR if you want, although it is not built primarily to work with SSR. You can also do Deferred-static Generation (DSG), which simply means the HTML is produced when the user makes a request, that makes the website faster.

The biggest downside to Gatsby is the build time. When you hit build, it could take minutes to build your website, and the bigger the website, the longer it takes. As of now, Gatsby has introduced incremental builds, where only the updated part will be rebuilt, which works not as fast as SSR when doing changes, but is much more convenient especially if the urgency of showing the data online is not the first concern. Unless you have edge cases like news websites, where any update should be immediately made public, Gatsby can take care of most of the business needs of today.


Blandy Castro another one of our new dev team members has also worked with React and WordPress in the past as well in the security and dev ops sector. She had this to say about GraphQL:

GRAPHQL – What does GraphQL do for us that is better than an API

GraphQL is a query language built in 2015 by Facebook to solve several problems they faced while building their APIs with REST. Here is what it can do better than REST API.

Pros:

Cons:


Headless CMS options for React

We are currently building out some internal projects using React, Gatsby and GraphQL. We’ve got the front end covered but what about the Content Management system? Many of our internal sites and products are built on the WordPress CMS. Can WordPress be Headless?

Yes it can! and here are my thoughts on WordPress as a CMS for a Headless websites.


Seonah Han has been with Glacier Media for several years now, working on a variety of projects across the company. One of these projects, Flyerstory, was built using the Strapi CMS. Here is what Seonah has to say about Strapi.


Naomi Papequash has been with GMD for a year now. In her time here she has expanded on her past experience in the e-commerce industry to become our in-house Shopify expert. She had this to say about the prospect of building Headless Shopify sites with Shopify’s new Hydrogen framework.

Shopify In A Headless World


If you’ve made it this far you are obviously very curious about Headless websites (and patient to boot). While Headless sites are nowhere near to taking over the market in the coming year, we do expect that 2022 will be the year that Headless sites start to make major inroads. We have seen that several technologies are fuelling this trend. In particular React, and GraphQL are making it possible for developers to use several different Content Management systems to build easy to maintain and highly functional web applications. The buy in that we are seeing at a corporate level from companies such as Automattic and Shopify suggests that this is a trend that is nowhere near dying out and will likely take over huge segments of the web.

Exit mobile version