Member-only story
Why You Should Consider Building Static Sites
If you’re building web pages in production, consider building and hosting them statically. This can simplify your life while benefitting your customers and your business. The benefits come from three properties of static pages:
- Generally good speed and performance
- Amenity to graceful degradation
- Simple, reliable, managed hosting options
Speed: good for the user and the business
This isn’t always true (and check out my article on when server-side rendering is preferable to static for performance reasons), but generally static pages are going to be faster to fetch and load than server-side rendering (SSR) or client-side rendering (CSR). Shorter load times create a nice experience for your user, and they have also been shown to improve conversion rates, which leads to better business outcomes.
The shorter load times are due to the rendering — or really the lack thereof. For a static site, the HTML is all rendered in advance, so all your server has to do is serve a plain HTML file to your user. There may be some hydration required in the user’s browser, but as long as you aren’t blocking your whole page waiting on that hydration, you can most likely give your user a contentful paint right away. The perceived load time is short.
With SSR though, the HTML needs to be rendered when a request comes to the server. Depending on how much HTML is being rendered, and what data is being fetched before rendering, there can be a lengthy response time. Users won’t see any content during this time, since there isn’t any HTML to start processing until your server responds.
Further, fetching data and rendering HTML can be demanding on the server, causing it to slow down under load. If the data being fetched is unique for each incoming request, this may be unavoidable. But I’ve often seen engineers use SSR (or CSR) to fetch data that actually isn’t changing from request to request, meaning that there’s a lot of time being wasted making calls and rendering HTML when it could’ve been done once.
Lastly, CSR needs to render HTML as well, but it all happens in the user’s browser. A small bit of HTML is retrieved from a server, which then…