Back to the wiki

Single-page application (SPA)

A Single Page Application (SPA) is a web application that loads just a single HTML document in the browser and then dynamically updates all further content using JavaScript, without fetching a completely new page from the server for every click. Instead of rebuilding the entire page with every change, the SPA only updates the areas that have actually changed. The result feels as fluid as a native app.

How does a Single Page Application work?

When first accessed, the browser loads a lightweight HTML skeleton and a JavaScript bundle. From this point onwards, JavaScript takes control: it renders the interface, responds to clicks and fetches the required data in the background via an API, usually in JSON format. When the user navigates, the SPA merely simulates a page change: the URL changes, but the browser does not reload the page entirely; instead, the framework displays the appropriate view.

The role of routing

To make an SPA feel like a traditional multi-page website, a so-called client-side router manages the navigation. It ensures that each view has its own URL, that the back button works and that links remain shareable, even though technically a full page reload never takes place.

Frameworks for SPAs

Most SPAs are built using one of the major JavaScript frameworks: React, Vue or Angular. They provide the building blocks for reusable components, state management and routing. Which framework is best suited depends on the team and the project.

SPAs vs. traditional multi-page websites

CriterionSingle-page applicationMulti-page website
Page transitionswithout reload, dynamicfull reload per page
Perceived speedapp-like, fluidtraditional, with loading pauses
Initial load timetends to be higheroften lower
SEO out of the boxchallenging (see below)simple
Server loadlow (data only)higher (HTML per page)

Advantages of SPAs

  • Fast interaction: After the initial load, the application responds immediately because only data – and not entire pages – is reloaded.
  • App-like experience in the browser: Transitions, forms and live updates appear fluid and modern.
  • Clear separation: The front-end and back-end are decoupled via the API, which facilitates parallel development and reuse of the API.
  • Good for data-intensive interfaces: Dashboards, portals and internal tools benefit particularly.

The SEO challenge and its solution

The biggest weakness of pure SPAs concerns visibility. Because the actual content is only generated in the browser via JavaScript, a crawler initially sees only an almost empty HTML skeleton when it first accesses the page. This is a problem for traditional search engines and, in particular, for AI crawlers designed to index content. The solution is called server-side rendering or static generation: the server delivers the finished HTML version, and the JavaScript only takes over in the browser afterwards. This step, in which the delivered HTML content is made interactive in the browser, is called hydration. Modern meta-frameworks thus combine the SEO strengths of server-side rendered pages with the fluid behaviour of a SPA.

Real-world example

A B2B retailer operates a customer portal featuring long, filterable order and quotation lists, a self-service area and an approval workflow. A multi-page website would reload the entire page every time a filter was changed, which feels sluggish. As a single-page application, the interface remains static, and only the list updates in a fraction of a second, whilst the data is fetched via the API in the background. For public, SEO-relevant pages of the same shop, server-side rendering is also used to ensure that search engines and AI systems can index the content properly.

When an SPA is worthwhile

An SPA is the right choice for interactive, data-intensive applications: customer portals, dashboards, configurators, internal tools and headless storefronts. For a purely content-based website without much interaction, however, the extra effort is rarely justified. A detailed definition of the concept is also provided by the MDN Web Docs Glossary. It is crucial to plan the SPA from the outset with performance and visibility in mind, rather than trying to fix SEO issues retrospectively.

State management in single-page applications

Because an SPA does not reload with every click, it must remember its current state: Who is logged in, what’s in the shopping basket, which filters are applied? This task is handled by what is known as state management. Smaller applications can make do with the framework’s built-in tools, whilst larger ones rely on dedicated solutions that keep the state centralised and traceable.

Local and global state

A distinction is made between local state, which affects only a single component – such as whether a menu is open – and global state, which affects the entire application – such as login details. A clear separation of these two levels is crucial to ensure that an SPA remains maintainable even as its functionality grows.

Server data as a separate category

Data coming from the server plays a special role. It must be loaded, cached and updated as required. Specialised libraries take this work off teams’ hands and ensure that the user interface always displays consistent data, without each component having to organise the loading process itself.

SPAs and security

Because the logic of an SPA runs in the browser, special security rules apply. Sensitive checks must never take place solely in the front-end, as the user can view and manipulate the browser code. Every SPA therefore requires a backend that handles all security-related decisions – such as authorisation and data validation – on the server side. The frontend provides convenience, whilst authority lies with the server.

Authentication also follows its own patterns: instead of traditional server sessions, tokens are often used, which the browser sends along with every request. If these tokens are stored securely and properly protected against misuse, an SPA is just as secure as a traditional application.

Frequently asked questions about single-page applications

Is an SPA bad for SEO?

A pure SPA without any additional measures is indeed bad for SEO, because the content is only generated via JavaScript. However, this can be fully resolved using server-side rendering or static generation, allowing search engines and AI systems to index the content properly.

What is the difference between an SPA and a Progressive Web App?

The two are not mutually exclusive. An SPA describes the technical architecture involving a single page and dynamic reloading; a Progressive Web App describes additional capabilities such as offline use and the ability to be installed. Many PWAs are built as SPAs.

When should I avoid building an SPA?

For a simple, largely static content website without much interaction, the additional effort involved outweighs the benefits. In such cases, a traditional, server-side rendered approach is often the better choice.

Single-page applications in e-commerce and portals

SPAs really come into their own in retail and B2B portals. A modern, headless storefront separates the front-end from the commerce back-end via an API and can be implemented as an SPA that feels fast and app-like. Filtering, sorting and adding items to the basket happen without a page reload, which makes the checkout process smoother.

In customer portals – for example, for order overviews, quote approvals or self-service functions – the SPA impresses with its immediate response to every input. Long, filterable lists containing thousands of rows can be navigated smoothly, as only the visible data is reloaded. This type of application – data-intensive and highly interactive – is the classic sweet spot for single-page applications.

It’s the combination that makes the difference

Successful projects deliberately combine both worlds: public, SEO-relevant pages such as product and category pages are rendered on the server side so that search engines and AI systems can index the content accurately; protected, highly interactive areas such as the customer account run as an SPA. Modern meta-frameworks allow precisely this blend within a single project, so that teams do not have to choose between visibility and user experience, but get both.

It is crucial to plan this architecture from the outset. Those who build a pure SPA and only retrofit SEO later on will pay the price; those who deliberately choose the rendering strategy for each page type will end up with a front-end that is fast, visible and user-friendly all at once.

Further reading