Reading time is 4 minutes
While creating this website from the wonderous Zola, I got thinking about the applications of a static site for more then a blog. A full web application that can run entirely from a cdn with all the benefits (and problems) that would cause? Further more could we have low level atomic experimentation on the smallest of html changes?
<tl> We're gonna put Airbnb in a cdn. </dr>
Yes.
Originally website were a single html document. The glory days my vision of perfection! With time new technologies were added giving client side logic, webservers that could change the document before it was formed, databases were bolted on to give a unique experience to every user! How can we replicate these complex behaviours with a load balancer and a cdn?
For the sake of this article we shall focus on fluffy theoretical ways we could accomplish a purely cdn driven website with enough complex features to be indistinguishable from your airbnb's of the world. But with that goal we will need to emulate a set of features I feel are imperative to a successful tech company:
experimentation: a/b or multivariant tests must be able to be ran
content: content must be editable and dynamic with full i18n support
sessions: the scripts must be able to hold onto a session id or token effectively and pass it to the next pages
rich ui interactions: the ui must be reactive and responsive
data: unfortunately serving data through the cdn maybe overkill (though totally possible) so this will have to use conventional methods of services that our rich web app will query.
On top of these arbitruary requirements I have a few goals and reasonings behinds this approach
Actually getting the site running with content is simple enough and Hugo and Zola provide options for localization which takes care of that as well so these steps are completed for us presuming we choose a static site generator.
The rich ui elements can be accomplished with
[# experiment <name> do <div></div> else <span></span> #]
that results in two bundles, one with the <div></div>
the other with the <span></span>
the name of these bundles should be reproducable or recorded to be sent to a load balancer that will handle the routing.
Over the next few months I intend to start some opensource projects, each with a corresponding blogpost explaing what part they will play in making this concept a reality. They will all be moving the server rendering to the build step.