Heya, I'm Carl! I'm the solo founder of Ymir. Ymir is an open startup. You can view its up-to-date business metrics, and also sign up for a newsletter where you can learn how I'm building and marketing it. Check it out.

What’s the difference between headless and serverless WordPress?

In the last few years, two new terms have emerged in the WordPress and larger web development space. Those two terms are headless and serverless. On top of both being terms ending in “-less”, they’re two terms that aren’t very self-explanatory. (Are there still servers with serverless? Yes. Is headless some new horror movie category!? Nope!)

But to make things worse, because you often use these two new development paradigms together, people use the two terms interchangeably or think they’re the same thing. But they’re not! This increases the confusion and suspicion around both paradigms.

So with that in mind, this article will walk you through both concepts. This should hopefully clear some of the confusion. But we’ll also see how both paradigms are changing the WordPress development landscape. Let’s go!

Headless: decoupling frontend and backend

Headless WordPress websites are the result of the rise in popularity of JavaScript as a full-fledge programming language. As JavaScript popularity grew, new ways to build websites became popular. King among them was the single-page application.

If you’re not familiar with a single-page application, it’s basically a JavaScript application that runs in your browser. If needed, it’ll communicate with a backend to get any data it needs or perform other operations such as sending email. With WordPress, that backend is your WordPress installation.

A single-page application like I described is headless. That’s because the frontend (the head in the analogy) is decapitateddecoupled from the backend (the body). This separation between backend and frontend is really all that headless means.

So when we’re talking about headless WordPress, it’s just a WordPress site where you only use WordPress as a backend. You don’t need to use a theme to display your WordPress content. That’s done by the frontend application. In that scenario, your major frontend decision on the WordPress side is whether you want to use the REST API or GraphQL API to communicate.

Serverless: on-demand computing

This brings us to serverless. Serverless is a marketing term to describe function as a service. Functions as a service allow you to run code on demand without the need to manage a server. This is where the serverless name comes from.

Serverless is an interesting paradigm shift because it allows developers to focus on writing code and not worry about where it’ll run. If you’re curious about how hosting WordPress using serverless is different vs using a server, you should check out this article. The interest in serverless is also tied to the growing popularity of microservices architecture. With serverless, it’s easy to create small microservices by just writing some code and deploying it.

Once deployed, you also don’t have to worry about scaling these microservices. Serverless scales automatically. So there’s no worry that you’ll blow up your server if you get a traffic spike.

This ability to scale on-demand is a very powerful feature of serverless. It’s also why serverless makes for an ideal platform for hosting WooCommerce. Hosting a WooCommerce site is more demanding than a regular WordPress site and serverless, with its on-demand scaling, is ideal for it.

Why are headless and serverless used together?

Now, the more interesting question is why are those two terms confused with one another. It’s basically because both paradigms are complimentary. Let’s go back and look at headless again.

With headless, you have a JavaScript frontend application that runs in the browser. You don’t need a server to host it. You just need to put the code somewhere the browser can download it. (Often it’s just on a content delivery network (CDN).)

This frontend application needs to communicate with a backend to get any data it needs, make changes to it or perform other operations. This backend needs to be hosted somewhere.

You could use a server to do that. But you already have a frontend application that doesn’t need a server. Why not just go all in and have the backend not use a server as well!? So you’ll see a lot of these frontend applications also use a headless and serverless backend.

That’s why those two terms are often confused with one another.

You can have one without the other

That said, while this confusion exists, the reality is that you can have a headless WordPress site without a serverless backend. In fact, none of the headless WordPress sites have a serverless backend. They just host WordPress on a server.

That’s because Ymir is the only platform that lets you deploy WordPress on serverless infrastructure. But at the same time, you can have a serverless WordPress site that isn’t headless. The Ymir blog that you’re reading this article on uses serverless, but it’s not a headless WordPress site.

So there you have it, headless and serverless, two terms shrouded in mystery, but hopefully, demystified at last!