We are building a decision framework — the mental model that every frontend engineer reaches for when starting a new project, evaluating an existing one, or answering the inevitable "MPA vs SPA?" interview question. But unlike most articles that list pros and cons in a table, I want to walk through what it actually feels like to build and ship both architectures.
Imagine a typical e-commerce site: a landing page, a product listing page, a product detail page, a checkout flow, and an admin dashboard. If you build this as an MPA, clicking a product link triggers a full-page navigation — the browser shows a loading spinner, fetches a new HTML document, and re-renders everything from scratch. If you build it as an SPA, the same click is intercepted by JavaScript: the URL updates, a JSON payload arrives in the background, and React patches the DOM — no flash, no flicker, no delay.
Here is what the server-side controller looks like in the MPA world:
// Traditional MPA — Express.js route handler
import express from "express";
import { renderToString } from "my-template-engine";
const app = express();
app.get("/products/:id", async (req, res) => {
const product = await db.products.findById(req.params.id);
const related = await db.products.findRelated(product.category);
// Server renders a complete HTML document
const html = renderToString("product-page", {
title: product.name,
meta: { description: product.description },
data: { product, related },
scripts: ["/static/product-page.js"],
styles: ["/static/product-page.css"],
});
res.send(html);
});And here is the SPA equivalent — a client-side router with lazy-loaded route modules:
// SPA — Client-side router with lazy-loaded routes
import { createBrowserRouter, RouterProvider } from "react-router-dom";
const router = createBrowserRouter([
{
path: "/",
element: <Layout />,
children: [
{ index: true, element: <HomePage /> },
{
path: "products/:id",
// Lazy-loaded — only fetched when navigated to
lazy: () => import("./pages/ProductPage"),
},
{
path: "checkout",
// Heavy page — deferred until user needs it
lazy: () => import("./pages/CheckoutPage"),
},
],
},
]);
export function App() {
return <RouterProvider router={router} />;
}These two code samples capture the entire philosophical difference. The MPA controller owns the full response: it decides the HTML structure, the CSS, the scripts, the metadata. The SPA router owns the experience: the initial payload is a shell, and everything else is fetched on demand. One is declarative at the server level; the other is imperative at the client level. Neither is wrong. The trick is knowing which one fits your constraints.