Why JAMStack hosting is not a solution

Interest in JAMstack is growing and many developers believe that the JAMstack approach to web development, which is in many ways faster, more secure and more stable than the traditional stack, represents the future of the web. But it also has many disadvantages and problems.

In the following article I will explain what a JAMstack is, why it was created and which advantages and disadvantages it has, especially in combination with a classic CMS like WordPress.

Definition: What does JAMstack mean anyway?

The term JAMstack was coined by Mathias Biilmann Christensen, the co-founder of Netlify, to describe “more modern” approaches to web development as opposed to the well-known LAMP stack. JAMstack refers to the serverless, database-less stack consisting of Javascript, APIs and markup.

The stack formerly known as static was rebranded by Matt Biilmann as JAMStack, because the term static no longer really describes what a modern static website can do, which can also be very dynamic thanks to modern Javascript and CSS functions.

How did it come about that an alternative to the LAMP stack was sought?

Until about 1999, most websites consisted of simple HTML, a few images and CSS. All quite simple and manageable, the so-called static websites. These were delivered quickly and were also very secure, because no dynamic code was executed on the server, the web server simply sent the browser the finished HTML file that was on the server and that was it.

However, changes to static pages were relatively uncomfortable. Most web developers modified the HTML source code in a text editor and transferred the modified file to the web server via FTP. It was virtually impossible for a customer without technical understanding to maintain a website, and the simultaneous work of several people on one and the same page was out of the question!

The first dynamic functions were made possible via the so-called Common Gateway Interface, CGI for short, in the Apache web server, which had been in work since 1993. So my first websites sent filled out contact forms via sendmail using a small PERL script. With the appearance of PHP this kind of dynamic websites spread and soon web content management systems were created, which still run on the LAMP stack, i.e. Linux, Apache, MySQL and PHP. Instead of Apache, the more modern NGINX is often used and instead of MySQL, a MariaDB can also be used.

Without appropriate precautions, however, in this type of setup every page request triggers a cascade of file and database accesses as well as PHP functions, which made the generation of the website slower and slower. To get this problem under control, caches were implemented at various levels of the stack, from hard disk caches, database caches, object caches and full page caches to CDNs and the local browser cache, as much as possible is stored so that the same information can be delivered again more quickly. Modern WordPress hosting is more and more complex in operation due to the many caches and due to the necessary invalidation of the caches in some cases not so much faster, but saves CPU time on the host system.

The bigger problem of the current LAMP stack is in my opinion the software security: Almost daily security patches, updates or 0-day exploits for WordPress plugins, themes or even the core are released. A permanent update becomes more and more complex and can rarely be automated and without subsequent functional checks in critical infrastructure.

Finally, scaling dynamic pages is also a big challenge: If you are running a website and there are load peaks or even a Ddos attack, it is definitely a challenge to keep the website up and running quickly or at all. Actually, you should be happy about large traffic increases and not be afraid that the website will come to a standstill because of it.

So let’s take a closer look at the JAMstack. Does it solve the problems of the LAMP stack?

Indeed, static page generators solve many of these problems, but create some new problems! JAMstack is basically nothing more than the combination of Javascript, APIs and markup like HTML and CSS. This eliminates the need for a dynamic server-side programming language like PHP, Perl, Python or Ruby. So you don’t really need a (classic) server anymore. Of course, the files have to be made available somewhere for the users, but in JAMStack this is simply done on a PushCDN and thus distributed worldwide and very similar to every potential visitor.

Speed: Every page is already pre-rendered in the CDN, which makes the delivery really fast! The PHP doesn’t have to process anything, no database has to be queried, no CPU has to do any computing and no RAM can overflow!

Security: Without a page-generating processing server there is automatically more security! Because there are no more vulnerable applications of the LAMP architecture. Where normally everything has to be patched continuously, from database and operating system of the server to PHP and CMS to plugins and themes. These patches simply do not exist in the world of JAMstack, because JAMstack is 100% database-free.

Scalability: If you only need to deploy static assets that do not require server-side processing, you can scale them almost infinitely over a worldwide CDN. Since this consumes far fewer resources such as compute time, power and cooling, serverless hosting is better for the environment.

Cheaper: There are many free or inexpensive services available for hosting static websites. These costs can of course add up if you have a lot of traffic, but the bottom line is that the costs are much lower than with traditional hosting!

That sounds too good to be true! Are there also disadvantages?

Oh, yes, there is. Static site generators often require the use of the command line or have to be operated via cumbersome APIs without GUI. Although there are now some CMS that you can connect to a static site generator, they are much more limited than what a WordPress for example has to offer.

After every change on the website the whole website has to be regenerated and pushed to the CDN. This can even take several hours for complex websites, which makes frequent publishing or quick changes impossible. That means: If you make a change on a page, you have to republish your whole page and wait until it is finished before you can make another change! This also prevents parallel work by multiple authors.

If you think the LAMP stack is complicated, don’t even try the JAMStack. The combination of headless CMS, static site generator and front end with client-side dynamization via APIs is extremely complex to develop. It is very difficult to find developers with the necessary skills. In addition, there is currently a very limited plugin and theme ecosystem. In contrast to WordPress, where there are more than 50,000 plugins and millions of themes and fantastic theme builders like Elementor.

To get an idea of the complexity of the JAMStack, just have a look at the tutorial Migrate Your WordPress Site to the Jamstack at Netlify

If you want to try out the advantages of the JAMStack and still don’t want to miss the comfort of a WordPress installation, you currently have three options:

1. WordPress as headless CMS with Gatsby

If you still want to use WordPress as a headless CMS, you should have a look at the new project: Gatsby WordPress Themes. You can save a lot of time by simply using a ready-made Gatsby theme based on popular WordPress themes.

This approach makes it much easier to use WordPress as a headless CMS in JAMStack to manage your site and use Gatsby to implement a React frontend. There are not many themes available yet, but I can still change that.

Theoretically you could also install the Gatsby blog (a pre-built JAMstack website) on Cosmic JS and then use an importer to import the existing WordPress posts and then make the website available via Netlify. You can find instructions here. But you will lose a lot of functionality and there is no way back to WordPress!

2. WordPress with a WordPress Static Site Generator Plugin

There are two WordPress plugins that can help you to create a static version of your page. Better said there were, because Simply Static and WP2Static are both no longer developed. But in case of WP2Static there is at least one active community and support in a forum on https://staticword.press/.

3. WordPress as a static site generator on a serverless hosting at strattic

Currently the easiest way to benefit from both WordPress and the JAMstack is to use a platform like strattic, which turns your WordPress page into a static page and puts it on a serverless architecture.

The great thing about this platform is that you use your WordPress page as usual and then click a button to upload a static version of your page (HTML, CSS, Javascript) to a CDN, which pre-renders the static page and delivers it super fast everywhere. This approach makes it really easy to switch to the JAMStack, but unfortunately even this approach has its disadvantages:

Currently, strattic does not offer Ajax functionality, nor the possibility to run logins, comments or something like member sites, not to mention e-commerce and online store with WooCommerce.

My conclusion

JAMstack’s approach offers really exciting new ways to bring websites to the web that are fast, secure, and scalable, but what good is that if you can’t use your beloved CMS, WordPress, or have to do without important features?

My conclusion is therefore: The JAMStack is technically quite interesting, but for current WordPress users it is unfortunately not (yet) suitable for practical use!

Let’s see how existing JAMstack solutions for WordPress like stattic or the Gatsby Themes develop and maybe we will be able to use the advantages of WordPress as well as the JAMstack some day.