Single-Page Application
Subject: Computer and Technology noun /ˈsɪŋ.ɡəl peɪdʒ ˌæp.lɪˈkeɪ.ʃən/ 1 definition
- web-development
- frontend-architecture
- web-architecture
- javascript
-
Definition (noun)
Entry #325 · UpdatedA Single-Page Application (SPA) is a web application architecture that loads a single root HTML document and initial JavaScript bundle from a server, then renders and updates views dynamically within the browser without triggering full-page HTTP reloads. As a user interacts with the interface, client-side code intercepts navigation events, mutates the Document Object Model (DOM) in place, synchronizes browser URLs via the History API, and exchanges asynchronous payloads—typically JSON over the Fetch API or WebSockets—with backend REST or GraphQL endpoints. By shifting template rendering, routing, and UI state management from the server to the browser runtime, an SPA delivers fluid, app-like transitions while decoupling frontend presentation from backend data services. Its primary boundaries involve initial bundle download and script execution overhead, search-engine indexing constraints without pre-rendering, and heightened client responsibility for memory lifecycle management, accessibility focus handling, and authentication token security compared to traditional Multi-Page Applications (MPAs).
Common Forms
Pure Client-Side Rendered (CSR) SPA: Serves a minimal HTML shell containing a root mount element and script references from a CDN or object store, delegating all routing, data fetching, and DOM rendering to browser JavaScript—well suited for authenticated dashboards and internal tools.
Hydrated Server-Side Rendered (SSR) SPA: Renders the initial route's HTML on a Node.js or edge server for rapid first paint and search-engine crawlability, then attaches client-side event listeners through hydration so subsequent route transitions run as an SPA.
Pre-Rendered Static SPA: Generates static HTML snapshots for known routes at build time via Static Site Generation (SSG) and transitions into a client-side SPA once the JavaScript bundle executes, combining CDN edge cacheability with interactive post-load navigation.
Progressive Web App (PWA) SPA: Augments an SPA shell with a Web App Manifest and Service Worker that intercepts network requests to cache static assets and API responses locally, enabling offline resilience, background sync, and installable app-like behavior.
Example
When a user opens a project-management web app built with React, the browser downloads a compact
index.htmlshell and compiled JavaScript bundle from a CDN over HTTPS, rendering the workspace client-side from an initialGET /api/v1/boards/42JSON response. Clicking a task card callshistory.pushState()to update the address bar to/boards/42/tasks/108and retrieves task comments viafetch()without reloading the document or re-fetching shared stylesheets.