title: Multi-page web apps
url: https://adactio.com/journal/20442
hash_url: efc348f6559d55129657c7ba9d740b76

<p>I received this email recently:</p>

<blockquote>
  <p>Subject: multi-page web apps</p>
  
  <p>Hi Jeremy,</p>
  
  <p>lately I’ve been following you through videos and texts and I’m curious as to why you advocate the use of multi-page web apps and not single-page ones.</p>
  
  <p>Perhaps you can refer me to some sources where your position and reasoning is evident?</p>
</blockquote>

<p>Here’s the response I sent…</p>

<p>Hi,</p>

<p>You can find a lot of my reasoning laid out in this (short and free) online book I wrote called Resilient Web Design:</p>

<p><a href="https://resilientwebdesign.com/">https://resilientwebdesign.com/</a></p>

<p>The short answer to your question is this: user experience.</p>

<p>The slightly longer answer…</p>

<p>For most use cases, a website (or multi-page app if you prefer) is going to provide the most robust experience for the most number of users. That’s because a user’s web browser takes care of most of the heavy lifting.</p>

<p>Navigating from one page to another? That’s taken care of with links.</p>

<p>Gathering information from a user to process on a server? That’s taken care of with forms.</p>

<p>This frees me up to concentrate on the content and the design without having to reinvent the wheels of links and form fields.</p>

<p>These (let’s call them) multi-page apps are stateless, and for most use cases that’s absolutely fine.</p>

<p>There are some cases where you’d want a state to persist across pages. Let’s say you’re playing a song, or a podcast episode. Ideally you’d want that player to continue seamlessly playing even as the user navigates around the site. In that situation, a single-page app would be a suitable architecture.</p>

<p>But that architecture comes at a cost. Now you’ve got stop the browser doing what it would normally do with links and forms. It’s up to you to recreate that functionality. And you can’t do it with HTML, a robust fault-tolerant declarative language. You need to reimplement all that functionality in JavaScript, a less tolerant, more brittle language.</p>

<p>Then you’ve got to ship all that code to the user before they can use your site. It might be JavaScript code you’ve written yourself or it might be a third-party library designed for building single-page apps. Either way, the user pays a download tax (and a parsing tax, and an execution tax). Whereas with links and forms, all of that functionality is pre-bundled into the user’s web browser.</p>

<p>So that’s my reasoning. At least nine times out of ten, a multi-page approach is leaner, more robust, and simpler.</p>

<p>Like I said, there are times when a single-page approach makes sense—it all comes down to whether state needs to be constantly preserved. But these use cases are the exceptions, not the rule.</p>

<p>That’s why I find the framing of your question a little concerning. It should be inverted. The default approach should be to assume a multi-page approach (which is the way the web works by default). Deciding to take a JavaScript-driven single-page approach should be the exception.</p>

<p>It’s kind of like when people ask, “Why don’t you have children?” Surely the decision to <em>have</em> a child should require deliberation and commitment, rather than the other way around.</p>

<p>When it comes to front-end development, I’m worried that we’ve reached a state where the more complex over-engineered approach is viewed as the default.</p>

<p>I may be committing a fundamental attribution error here, but I think that we’ve reached this point not because of any consideration for users, but rather because of how it makes us developers feel. Perhaps building an old-fashioned website that uses HTML for navigations feels too easy, like it’s beneath us. But building an “app” that requires JavaScript just to render text on a screen feels like <em>real</em> programming.</p>

<p>I hope I’m wrong. I hope that other developers will start to consider user experience first and foremost when making architectural decisions.</p>

<p>Anyway. That’s my answer. User experience.</p>

<p>Cheers,</p>

<p>Jeremy</p>

