JAMstack series (part 1 of 4): Basics of JAMstack
Web development is not the same it was 10 years ago. Even though dynamic CMS platforms like WordPress or Drupal can make life of users easier, it also comes at the cost of less performance and less security.
This is the first part of a four parts series on the JAMstack framework.
Table of Contents
- What is JAMstack?
- How JAMstack works?
- How is JAMstack different from the traditional model?
- What are the benefits of JAMstack?
- What are the limitations of JAMstack?
What is JAMstack?
- APIs — The API determines how you access the data. They are a reusable abstraction of what was present on the server in a traditional model.
- Markup -They are generated from the source files with the help of a static site generator or build tool. In simple words, the Markup is used to create content for static websites that are then served as an API endpoint.
How JAMstack works?
A JAMstack framework is widely used for building static websites. To build them using JAMstack, we use a Static Site Generator (SSG). A developer can add content to these static websites in multiple ways. They can use a headless CMS or a Git-based push of content with the help of a markdown. The content from either of these methods is received at the SSG. In the SSG, the code gets converted into a static site once the content is pulled.
How is JAMstack different from the traditional model?
In the traditional flow, the building and hosting mechanisms are coupled. So whenever a user requests a page, the request gets processed and a response is generated after interacting with the database, web server, app servers, and the backend code. As a response, the entire HTML page is served to the browser. This means a slower load time and also makes the system vulnerable to threats due to multiple components (such as servers, databases, etc.) in the architecture.
In the JAMstack flow, the building and hosting are decoupled. So whenever a user requests a page, the page is already pre-built and readily available in the CDN. The Static Site Generator is used to build the static sites and the built files are shipped to CDN. Finally, the pre-built site is served to the browser. This means improved speed and reduced chances of security attacks due to no interaction with the servers.
What are the benefits of JAMstack?
First of all, the applications of JAMstack are served as static files directly from a CDN. This means your application will be quick to load. No more requesting the server for response where the server will build the entire HTML page first before responding.
There is no doubt that JAMstack sites will be cheaper than the regular sites since there is no server. There are no server maintenance costs in the case of JAMstack applications. Also hosting static assets are certainly cheaper as there are no server-side configurations to be implemented.
As you will be serving files from a static hosting like a CDN, there is a possibility of infinite scalability. Even if your website has an unprecedented surge in the number of visitors, the CDN will compensate for it without affecting the performance.
One of the biggest advantages of JAMstack architecture is its security. Since the number of systems that interact with each other is minimal, the surface area for attacks is less. There are no vulnerabilities due to databases, servers, or plugins. Instead, it is recommended to just focus on securing your private content and ensure that the user’s private information is not compromised.
The workflow of JAMstack is highly automated due to the use of static site generators and build tools. The deployment occurs through a simple Git Push based on the principle of Continuous Integration Continuous Deployment.
What are the limitations of JAMstack?
Though JAMstack offers a myriad of benefits for the developers and the users, it is not ideal for those web projects which have frequent and real-time updates and has a considerable amount of dynamic features for the user to interact with.
Another disadvantage of using JAMstack is that you can add components such as forms, comments, and galleries only with the help of 3rd party solutions. This means an additional burden of managing these 3rd party providers.
Lastly, any changes in the design of the website can be managed only by the developer and cannot be managed by you unless you are a developer.
In this post, we have seen the basics of JAMstack, how JAMstack works, and how it differs from a traditional technology stack. We also saw the many benefits it offers along with a note on the ideal target audience for this framework. JAMstack has been embraced by many companies across the world due to the low cost and the ease of development experienced by the developers.
Originally published at https://www.partech.nl.