Aller au contenu principal
JAMstack for Creating a Fast and Secure Website

JAMstack for Creating a Fast and Secure Website

The JAMstack is a way to create a "static" website that is very fast and secure. This technique began gaining attention among professionals in 2018/2019 and is growing in popularity. Indeed, this new method addresses the challenges faced by all websites, namely combining performance and security, while offering savings on hosting and maintenance.

What is the JAMstack?

To understand the specificity of the JAMstack, we must first revisit how a traditional website functions. When you want to display a page on a site built with a CMS (WordPress, Sanity, or others), files are executed to make requests to a database. This allows the "construction" of the requested page, particularly displaying text and images stored in the database. If you refresh the page, the same process repeats: your site makes a request to your database, and the page is constructed with the received information.

For a site designed in JAMstack mode, it's different. Your site is entirely generated beforehand, making a call to your data source only once to integrate the content across all pages. Thus, when you want to display a page, the page is already "constructed," eliminating the need for a database call, and if you refresh, you are shown this already generated page again.

This approach avoids repeatedly querying a database when you want to display a page that doesn't change or doesn't have specific content based on the visitor viewing it. After all, a company's presentation page or its services remains the same whether loaded from Paris or Tokyo. Therefore, there's no need to "rebuild" it with each display. This is precisely where JAMstack provides an efficient solution by displaying a pre-generated page.

Displaying these pre-generated pages explains why we refer to it as a "static site." This term should be taken with a LARGE grain of salt. Historically, a "static site" either referred to a site that wasn't frequently updated or had a somewhat outdated interface; or it described a site operating without a database, relying solely on HTML files. In the case of JAMstack, this is not the case. Today, we refer to a static site because the pages are pre-generated and not built with each visitor request. A static site in JAMstack is far from outdated; on the contrary, it is one of the most modern ways to design a site with the entire JavaScript ecosystem.

Top Performance and a More Resilient Site

A Much Faster Website!

Why switch to a JAMstack site? Firstly, because the performance is outstanding. Displaying static pages without systematically calling a database increases speed. Moreover, JAMstack sites are optimized for compression and minification. In short, your site is much lighter, therefore faster.

Here's an example with the same site (same images, same look, same text) designed with WordPress and a version designed in JAMstack (using the static site generator Gatsby and the WordPress API).

jamstack gatsby wordpress

In the end, we have a site that loads twice as fast with a homepage whose size has been reduced by seven times! In a context where mobile display continues to gain market share, these performance gains are significant and will have a direct impact on the success of your website and the contacts it will bring you.

A static site is secure by default

Often, website hacks occur because files are modified or the database is attacked. In the case of a site designed with JAMstack, the site is static, it does not communicate directly with a database, which is one less risk. Moreover, the files are not corruptible because they are not hosted on a traditional FTP but on a CDN. Thus, you are no longer vulnerable to traditional hacks.

Handling traffic spikes

Another positive aspect of a static site is that it handles traffic spikes much better. Indeed, during a "load increase," a site can stop functioning because the database is heavily solicited. In the case of a static site, which does not call on the database with each page display, these load increase issues disappear. The site then handles traffic spikes much better while maintaining fast loading speeds.

Excellent SEO

These performance gains also influence the quality of your site's SEO, its natural referencing. With equal content, search engines will always favor a lighter and faster site.

A more economical site

Who says a more secure and lighter site also means lighter maintenance and hosting. Opting for JAMstack also allows you to have a website whose cost will be lower than a site with a traditional CMS.

… and more environmentally friendly!

Finally, the last point to highlight is that a static site favors eco-design. Every time a site calls on a database and generates a page, it consumes energy. Given the growing share of web traffic, we must find solutions to make these consultations more resource-efficient to limit their carbon footprint. JAMstack provides a tangible response to this ecological imperative.

Using WordPress in JAMstack mode

That being said, is this the end of WordPress? No. It is entirely possible to "connect" a WordPress site to power a static site. Concretely, the pages of the static site will be generated from the data contained in WordPress. You can also automate a new generation of the static site when content is updated on your favorite CMS. In this case, you retain the strength of WordPress, namely the ability to easily edit your content, while benefiting from the advantages of JAMstack.

In this scenario, you will no longer use WordPress themes or certain plugins, but only the WordPress API to use it as a "Headless CMS." This is referred to as a decoupled approach.

Designing a site using the JAMstack approach is not yet the most common method today because it requires additional technical skills. It is primarily adopted by major web players or companies seeking top performance. However, given the performance, security, and resilience benefits of this type of architecture, it is clear that this approach will gain market share in the coming years.