Glossary termWeb application architecture

Single-Page Application

Also known as: SPA

Web application that loads a single HTML page and then updates its content with JavaScript instead of loading fresh pages from the server.

A single-page application (SPA) is a website that behaves much like a desktop app. The browser loads one HTML page and a bundle of JavaScript once; after that, moving between views, submitting forms and loading data happen without full page reloads. The script fetches data from the server, usually as JSON through an API, and updates the page by changing the Document Object Model directly. Web email clients, online maps, chat tools and browser-based office suites are typical examples, where the interface must react instantly to user actions.

The approach grew from techniques popularized in the mid-2000s under the name Ajax, a term coined by Jesse James Garrett in 2005 for loading data in the background without refreshing the page; Gmail, launched in 2004, and Google Maps showed what was possible. Frameworks then made SPAs easier to build: AngularJS appeared in 2010, React was released by Facebook in 2013 and Vue followed in 2014. Client-side routing libraries update the address bar so that the back button and bookmarks still work even though no traditional page load takes place.

SPAs offer fluid interactions but bring costs. Large JavaScript bundles slow the first load, especially on low-end phones and slow connections. Content rendered only by scripts can be harder for search engines to index, and careless SPAs break behavior that ordinary page loads provide automatically, such as moving keyboard focus and announcing page changes to screen readers, a concern for web accessibility. In response, frameworks added server-side rendering and hybrid approaches, and some developers returned to static sites or server-rendered pages enhanced with smaller amounts of script.

Key points

  • An SPA loads once and then updates the page with JavaScript instead of requesting full pages.
  • Ajax techniques of the mid-2000s and frameworks such as AngularJS, React and Vue made SPAs mainstream.
  • Client-side routing keeps browser history and bookmarks working without traditional page loads.
  • Heavy script bundles can slow first loads and harm accessibility and search indexing if handled carelessly.

Related entries

Technology

React

Programming

Open-source JavaScript library from Meta for building user interfaces out of reusable components that update efficiently when data changes.

Technology

JavaScript

Programming

High-level programming language of the web, created at Netscape in 1995, that runs in every major browser and on servers through runtimes like Node.js.

Glossary term

Programming interface that represents a web page as a tree of objects, letting scripts read and change its content, structure and style.

Glossary term

Static Site

Programming

Website made of prebuilt HTML, CSS and JavaScript files served exactly as stored, without generating pages on a server for each visitor.

Glossary term

Web Accessibility

ProgrammingIdeas and Culture

Practice of designing and building websites and apps so that people with disabilities can perceive, understand and operate them fully.

Glossary term

REST API

ProgrammingAI

Web interface that follows the REST architectural style, exposing resources at URLs that clients manipulate with stateless HTTP requests.

Glossary term

Software architecture pattern that separates an application into a data model, views that display it and controllers that handle user input.

Technology

Vite

Programming

Front-end build tool and development server, created by Evan You, that uses native browser modules for fast startup and near-instant updates.

Referenced by

Other entries that discuss or point to Single-Page Application.