Static is going to be the new Dynamic in web technology!
February 07, 2021 - Suresh Chandra
Static, WTF!. Before you ignore the static as a 90s deja vu, let’s dive a little deeper. If you take any website (especially content heavy sites), most of the site is made of static content. We can render the static files (HTML, JS and CSS) during the build and serve that static content using CDN. APIs will add dynamic features to the the site using Javascript.
Why on the earth will I do that?
Insanely fast websites
With static content served via CDN servers sitting closer to the end users, and with no round trip to application server (or) database for most of the site, websites can be delivered to the end users, insanely fast. Faster sites offer better user experience and improved user retention. Static generation frameworks like GatsbyJS applies most of the performance best practices out of the box (Ex: Route based code splitting, inlining of critical css, optimized images, pre fetching, pre rendering etc).
SEO Boost:
Faster site improves the SEO score and brings more customers to the site due to better positioned search results and in turn increases the company's top line growth.
Moolah
Most of the site(except the APIs) will be served as static via CDN, that means there will NOT be any application servers or databases in production to serve your site. This will lead to immense cost saving as your customer base increases.
Highly secure
The absence of Application servers and databases in the production (application servers and databases will be used during build time to generate the static content) means the website is non-destructible. We don’t have to worry about DDOS or Zero day vulnerabilities. For the dynamic sections of the site that uses APIs, by relying on third party vendors (Ex: Okta for authentication, disqes for comments, stripe for Payments etc.) we can outsource the security aspects to those third parties. AWS Lambda (or) similar can function as the gate keeper for those API calls and store the Authentication keys. Lambda functions are charged based on usage (unless we opt for the "always on" option to avoid cold starts)
Site can scale (Hello Redditters!)
With the static architecture, the site will be ready for any unpredictable load. Go ahead spend the saving from the hosting on your catchy Super Bowl commercial. You site will be ready for the load after the super bowl commercial!!.
The Holy Grail
Companies like GatsbyJs are working on incremental builds, that can currently do incremental builds in less than a second. If those smart people working on the incremental build can bring down the incremental build time to be less 200ms, it going to bridge the gap between a Dynamic site and a Static site and in the future almost any site could be delivered as static!!.
Is there a fancy name for this Architecture?
The founder of Netlify coined the term Jamstack for this static architecture. The JAM in the Jamstack refers to JavaScript API and Markup.