Hybrid Static: A New App Architecture
Roots it a projects that's been in the works for years, both in my free time and as a primary component of my job at Carrot. While it was at first intended to be a way to speed up build times for smaller static sites, it ended up evolving into something that was much more, and in the latest release we stumbled across what is essentially a new way to build web apps, that's significantly more efficient than anything else we've encountered. We're calling the approach "hybrid static". But before we dive in, let's back up a little so we have some context.
A Short History of Web Apps
A couple years ago, Rails ushered in an era in which apps were built on top of monolithic frameworks that render views on the server side and send them to the client as the user requested them. Rails, Django, Sinatra, Flask, and a number of PHP frameworks were the primary targets for building new websites. Job listings for rails developers were off the charts -- so much so that it spawned an entire industry of "dev bootcamps" to teach rails and help to fill the enormous demand. Server side apps were king, there was no questioning it.
A New Era
Roots introduces the capability to build a different kind of app, one that is a mix between client and server-side rendering. This approach eliminates the shortcomings of both the all-client and all-server approaches by allowing the developer to choose which portions of their apps are compiled as static content, and which portions are loaded dynamically in response to user interaction, while sharing view templates between the two approaches. We are calling this approach "hybrid static". Let's break this down a little bit with an example.
As another example, imagine you are building a blog. You can make a very simple blog that's compiled as a static site, but once you pass a certain complexity point, it's simply no longer possible. For example, tags, categories, and search are three features that you cannot implement with a fully static blog. At the same time, blogs are typically infrequently changing, and it's a waste of resources to have a full server response to each request. For large portions of the content, you could just compile the page out to static any time the blog is updated rather than any time a viewer comes to the site, which is what happens with a fully server-side blog. The hybrid static approach lets you break down an app like this such that parts of it are static and the rest is dynamic. So the homepage showing the first five posts can be served as static, and be recompiled whenever a new post is added. But when the user clicks to the second page, it could be loaded from the server like a single page app and rendered into the same template as the first page through the magic of Roots. You can even connect Roots to a CMS like wordpress or contentful to allow non-developers to easily make updates.
This level of control over how you present your content offers a huge number of possibilities, and we're excited to see how developers put it to work. Check out Roots' tutorial videos and docs and build something awesome!