Speed up building a Monolithic app by skipping build steps
Late Feburary of this year, I worked on improving the speed of Course Hero’s frontend build process. I noted the impact of each improvement I made. I don’t t...
As all in web know, SEO drives growth. And naturally, a page with seemingly no content (from the perspective of an indexing spider) or one with a deferred render is not great for SEO.
In recent years, React has become one of the most popular frontend frameworks for high traffic sites. At Course Hero, all new projects since 2016 have been in React, leaving our Angular 1.3.x projects around until a large enough feature compels us to refactor.
However, Course Hero doesn’t have a Node.JS backend (the company predates the runtime by a few years). This means that logged out, critical landing pages - which must be tuned for SEO - can’t have the initial view with React on the server. A painful workaround for this is to render the intial view in an alternative way, using the backend’s templating language. The initial view generated in both implementations must be congruent, or else there’s risk of page flickering. Even then, it’s suboptimal, as React would not be able to hydrate from the inital, non-React rendered view, resulting in a longer than necessary bootup time. These reasons have steered the majority of projects at Course Hero touching landing pages away from using React.
We could could call out to an external process from our PHP backend to do this initial rendering, but we had a few reasons to not do that. We wanted to avoid installing Node on all of our web servers. We wanted to be able to scale Node rendering independently from our web servers. We wanted deployments for our React applications separated from main deployments to the entire site backend. And we wanted control over caching. To achieve these goals, I began implementing a microservice, Theia, in November 2017, and today we are announcing its open release.
As of this writing, Theia powers Course Hero’s new course study guides, and we are considering adopting it in other parts of the site.