WordPress vs. Gatsby.js: Which is right for you?
Plenty of content elaborates on speeding up WordPress (WordPress) with paid plugins. Meanwhile, there are only a few articles about shortening the load latencies of Gatsby-based sites. But it’s not because there are no relevant tools available.
There’s simply zero need for them: Gatsby was built with load times in mind. The same is valid for security. Gatsby has a narrow attack surface by design, while to protect WordPress, you’ll have to buy a monthly subscription to a security plugin.
You probably understand where we're going with this: you can do almost anything with WordPress, but your WordPress plugin expenses may quickly add up.
The truth is that you can build a much more performant Gatsby site. This may sound like a bold statement if you come from WordPress, but we will prove it further down the text.
Many merits stem from Gatsby being a static-site generator (SSG), so let’s first ensure you understand the concept. After that, we’ll look closely at how WordPress and Gatsby sites compare.
This post covers
What are static site generators?
By definition, an SSG is a tool that generates website HTML on the server, combining page templates and data at the build phase. Pages can be stored on the content delivery network (CDN) and served upon request.
The word static here juxtaposes the method to dynamic rendering, in which HTML is generated in browsers by executing JS code. The page behavior can change upon an event. That’s why the method is called dynamic.
Since servers have more computing power than client devices, server-side rendering is fast, and so is Gatsby.
But wait for a second, you may say, a WordPress website is also server-rendered!
Yes, but a WordPress site is rendered each time anew. This implies having a database latency–the time needed to retrieve data from a data source. In contrast, all data is retrieved at the build phase in SSGs, so it only takes time to serve pages.
That’s why SSG-based sites are faster than sites rendered otherwise. Yet data doesn’t get stale if you have regular builds. And there’s interactivity in place with hydration — binding event listeners to pages and turning them into a single-page application.
Now, if you are familiar with the field, you may wonder why to compare Gatsby vs WordPress since they are very different. We have foreseen this question — you can find the answer below.
Read more: What is a static site generator?
WordPress to Gatsby: is this comparison fair?
Truth is, the two products are very different — to the extent that they may seem incomparable, but bear with us for a second. While Gatsby is a front-end framework, WordPress is a monolith: it offers both a front-end solution and an in-built content management system (CMS). Thus, Gatsby only replaces a part of WordPress functionality.
But there’s a different angle to the question: we can consider the approaches to website architecture that Gatsby and WordPress adhere to, namely monolith and decoupled. While the monolith approach is old and cumbersome, the decoupled one is newer and gives you more freedom of stack choice.
In a decoupled model, front-end and back-end solutions are completely independent, meaning that you can go for any CMS you like. That said, you can couple Gatsby with a headless CMS and get a full WordPress substitute in terms of functionality.
From this perspective, WordPress and Gatsby allow for comparison. But before diving into it, we’ll explain why WordPress doesn’t cut it anymore.
WordPress’ used-to-be benefits
If you ask Google what the pros and cons of basing your site on WordPress are, you’ll find out that the main line of answers stayed intact in the last ten years. But the web is constantly changing and posing new requirements.
For instance, a free WordPress website now resembles a ticking bomb regarding security, and no serious businesses would use them. Still, the most prominent pro-WordPress argument goes like this: “WordPress is absolutely free to use because it’s open-source.”
True, you don’t need to pay for the core, but being open-source makes WordPress vulnerable to attacks. Since the CMS code is reused in thousands of websites, hackers can exploit the same attack vector if a vulnerability is discovered. So, you’ll need to pay a monthly fee for a security plugin.
Another so-called benefit is WordPress’s themes — there’s a vast variety of them, and you can choose whatever fits your purposes best.
Actually, can you, really? Some themes may be content-heavy and therefore have long load times. Also, UI may be glitchy, but no one will tell you this in advance, so you’ll have to conduct additional research.
This brings us to another “benefit”: WordPress is very SEO-friendly. True, there’s a wide variety of WordPress plugins for better SEO. But the more plugins you install, the slower your WordPress site is — which is harmful to SEO.
Then, do you need technical experience to handle a WordPress website? Oh, yes, you do! You need to hire experts who know the platform to give your website a professional look and feel.
Still, WordPress retains some benefits. Its CMS is familiar, and the community is immense, so you can get support easily. Also, integrations with other services don’t require much effort: almost all popular third-party tools offer WordPress integrations.
How WordPress makes you buy plugins
Most of the issues with WordPress can be solved with high-quality plugins, but their pricing will burn a hole in your wallet fast.
For instance, a WordPress site can be fast; you can reach short load times even for mobile versions thanks to caching, image optimization, and CDN deployment. But neither image optimization nor caching is built into the core; you’ll need to pay monthly for plugins enabling this functionality.
Here are other considerations you have to be aware of before starting your WordPress site:
You will pay monthly for a feature you need several times a year
The price of plugins is often obscured from the client
Cheap plans are often insufficient even for basic needs
A reputable hosting that keeps your data safe can be costly
Evidently, you can’t have a low-budget quality website based on WordPress. But is Gatsby the right alternative?
What is Gatsby?
Gatsby is a static site generator (SSG) based on React. If you worked with React in the past, it would be easy for you to explore Gatsby. The framework has comprehensive documentation, so you won’t struggle with finding answers.
There are several well-established meta-frameworks for React, and Gatsby is one of them. Meta-frameworks' role is implementing various optimizations and tunings, while React is your site’s backbone.
Gatsby is also developer-friendly. One of its unique features is its GraphQL layer, which makes data retrieval easier to implement.
Though, what truly makes Gatsby stand out is the money you pay for a high-quality website. Let’s unpack this.
Read more: What is Gatsby?
Why is Gatsby cheaper?
Securely hosting a WordPress site can get costly. With Gatsby, you can opt for a very generous free tier offered by hosting platforms like Netlify, coupled with CMS free tiers like the one offered by Dato, Sanity, or Agility CMS. We wrote a comprehensive post about the best headless CMS options if you need help choosing the right one.
Also, WordPress maintenance can get challenging. As your site grows and updates are installed, more conflicts arise between plugins, themes, and the CMS. So, developers may get stuck resolving them and not actually working on your business’s goals. In contrast, a static page won’t need much maintenance once they are deployed and running.
Probably the main economic benefit Gatsby offers is alleviating the need to buy plugins. Once you’ve developed a website, you only pay for hosting and third-party services your site needs.
Let’s look at the areas where Gatsby offers functionality out of the box where WordPress makes you pay.
Security is a core feature of a static website. There’s not much JS code exposed to attacks, and the backend is protected by proprietary CMS providers.
Static sites don’t have a database latency and are easy to deploy on a CDN close to users’ locations. Additionally, how you manage your resources influences load times. Here, Gatsby offers valuable optimizations.
Some features Gatsby offers in this area are:
Lazy-loading: loading images when they appear in the view front;
Image size optimization: resizing images according to how they will be used, i.e. serving smaller images for smaller screens;
Image placeholders: displaying a placeholder with a copy of the image of lower quality while the original image is being loaded.
Both load speed and image optimization are essential for business and SEO. If your page loads for more than 3 seconds, clients are twice more likely to quit, while the bounce rate is only 9% for pages that load within two seconds. So, the faster your website is, the higher you are ranked by search engines.
Gatsby facilitates this. The image optimizations it offers improve Core Web Vitals such as First Input Delay, Largest Contentful Paint, and Cumulative Layout Shift.
Also- Because Gatsby scores well on load times and visual quality, it’s ranked high by search engines without additional money investment into SEO.
Not only Gatsby solves the problems with WordPress but it also preserves the upsides as well.
Bright sides Gatsby shares with WordPress
WordPress’s community is immense, and you can get support easily — and so you can with Gatsby. Maintaining a supportive community is in Gatsby’s philosophy. Also, both in WordPress and Gatsby, integrations with other services don’t require much effort — there are plugins for that.
Actually, like in WordPress, all the needed behaviors are packaged in plugins and themes. So Gatsby is almost as intuitive as WordPress. But the “theme” and “plugin” concepts have slightly different meanings in a Gatsby world. Let’s explore them.
Like WordPress, a Gatsby plugin lets you add features to your site without building them from scratch. Plugins are downloadable and shareable collections of code featuring API calls related to specific functionality and packaged into npm.
Gatsby has plugins for everything: to style your site, gather statistics, optimize performance, or convert markdown to HTML. There are more than 3,000 plugins in Gatsby’s plugin library.
However, a Gatsby plugin can’t be installed in a UI — you must provide a configuration in a gatsby-config.js static file.
A WordPress theme defines how your front-end looks. When starting a WordPress website, you must pick a theme or accept the default one. Later, you can tweak the UI programmatically or with plugins.
Contrary to that, Gatsby themes are special plugins that allow you to avoid retyping basic configurations for data sourcing or UI.
Themes tend to cover a broader scope of responsibility than plugins. They package up multiple behaviors, while plugins are meant to modularize Gatsby APIs into smaller pieces.
If you need to create a landing page, you have to install a theme, but for a particular image format support, you need a plugin.
Gatsby also offers different starters with presets for working with various services like Netlify or the headless CMS of your linking.
It may seem that creating a Gatsby website requires more effort in the first stage because you need to hire developers and decide on a CMS.
Think twice: for WordPress, you must find a developer team and make many plugin-related choices. And you will soon end up with a way more expensive yet similar website requiring migration to a less outdated tech stack.
Whatever use case you have in mind, pick Gatsby out of the two. It offers the same ease of use as WordPress but with fewer expenses and maintenance effort.
Ready to build a web application with Gatsby?
We are Gatsby implementation partners and can help you build and manage your Gatsby project or application. We can build something from scratch or work with your devs to lend them an extra hand during implementation.