Are you confused about choosing the right architecture for your web application? This article will help you understand the key differences between the JAM stack and conventional web architectures, helping you make an informed decision regarding your web development architecture.
Evolution of Web Development
In the early days of the internet, web architecture was purely static. Websites created back then were only folders of static HTML and CSS files. A browser’s job was to let the user view the content based on these HTML and CSS files.
However, as the technologies evolved, they allowed us to create more advanced websites with the possibility of creating customized content. At that point, the HTML of a website had to be built at the time of request by a server.
Here’s how it used to work: A user requests a page, but instead of having it ready, the server consults the database and then presents the appropriate content to the user. There was an upside to this architecture, though. It allowed us to serve customized content based on the user’s requirements.
However, the major downside to this architecture was that it was slower than just having static HTML files. That’s because it only created each page upon request, which required more resources to build the right content.
Unfortunately, at the time, there was no other option to overcome this problem. To serve customized content, you had to let your server and database build it at the time of the request. All of this changed with the invention and maturity of JavaScript. It was developed to allow browsers to alter pages dynamically once the latter were loaded.
With this advancement, not only could people use JavaScript to add dynamic capabilities to their websites, but they could also offload some work from the server-side to client side, which resulted in efficient and faster delivery. It was during this time that websites based on the JAM stack architecture appeared. A website based on the JAM stack not only overcomes the dependency of back-end resources but also improves the overall user experience design.
Conventional Web Architecture
In a conventional web architecture – let’s say WordPress – the server receives a request. WordPress does some database queries to fetch the content, code, and data for your site and its plugins. It renders HTML and CSS and sends the result to the user. In other words, in conventional web architecture, the server handles each request separately and delivers the content to the user accordingly.
JAM Stack Web Architecture
JAM stack is a modern web development architecture based on JavaScript, APIs, and Markup (JAM). Instead of using a conventional CMS or site builder, the JAM stack architecture splits up the code, the site infrastructure, and the content.
The main reason for choosing it is to go as serverless as possible. That means taking away as many tasks as possible and pushing them to the client instead of the server for better performance and faster load time.
JAM stack has three core parts:
JavaScript: The universal runtime layer adds dynamic behavior to the browser.
APIs: They replace the database and fetch everything you need directly from the services required.
Markup: It serves the actual website content and HTML.
Architecture Comparison
The main difference between these two architectures is how tightly content, code, and designs are connected. With a conventional/legacy CMS, you handle everything in the same system, i.e., you have a back-end system where developers manage the code, design, and data. Moreover, your content is managed and created from the same interface and stored in a database. So, once a user requests a page, the back-end server assembles and delivers it to the user.
On the other hand, a JAM stack site works on the principles of decoupling and prerendering. In this setup, the server is only responsible for delivering static front-ends pre-generated at the build time. Therefore, you mostly rely on the client side instead of the server side.
Your pages are stored in a cache (typically using a CDN) as HTML and JavaScript, ready to be served to the user. Once a user visits your page, it will be prepared to handle the request without returning to the server and assembling it.
Pros and Cons of Conventional Web Architecture
Pros | Cons |
Broad choice of open-source standards | Relies on monoliths |
Works great for dynamic apps | Lacks in performance |
Most stakeholders currently work in this ecosystem | Tightly coupled and hard to maintain |
Pros and Cons of JAM Stack Web Architecture
Pros | Cons |
It can be blazing fast | Not content editor friendly |
Website is secure | Dependency on third-party services |
Scaling is easy and cheap | Dynamic features require more heavy lifting |
Better developer experience | Template changes require coding |
Is JAM Stack the future?
For the right project, the JAM stack is a good solution, and the decoupled architecture brings a lot of advantages to many websites. Right now, it’s still on the technical side, though, with both developers and editors needing certain technical skills to succeed. So, if your team does not possess the necessary skills to work efficiently with the JAM stack, you might not see the results you want.
But it doesn’t matter how fast a website is if your visitors see the same old content that editors find difficult to update. If you want to negate the primary con (the editor experience) of a JAM stack site, you should look at using a headless CMS with it. A headless CMS allows you to bank on a decoupled architecture with REST APIs that serve the content without adversely affecting the editor experience.
Therefore, we can safely conclude that the JAM stack web architecture is really the future of web development. Employ a headless CMS to overcome the limitations of the JAM stack architecture and build blazing-fast websites!