SPA
A single-page application (SPA) is a web app that switches screens without loading a new HTML document. The URL can still change, and the app can fetch data as needed.
Also known as: Single Page Application, одностраничное приложение
What “single page” means
Think of a project dashboard with separate URLs for a project list, a task board, and account settings. In a single-page application, moving between those screens updates the document that's already open. In a traditional multi-page app, each of those navigations loads a new document. The distinction is about navigation, not how many screens or URLs the app has.
What the browser does
On the first visit, the browser loads an HTML document and the JavaScript needed to run the app. Once the app is running, a client-side router typically handles clicks on internal links. It chooses which screen to show for the target URL and uses the browser's History API to update the address without loading another document. The router also responds to Back and Forward so the screen stays in sync with the address bar.
Client-side navigation isn't necessarily network-free. Opening a screen can trigger a request for its data or download code that wasn't needed on the first screen. The document stays in place even when those requests are in progress.
Example: a link that works until you refresh
Suppose you move from /projects to /projects/17. The router changes the URL and shows the project view, which can fetch its data from /api/projects/17. Now paste /projects/17 into a new tab: this time the browser asks the server for an HTML document at that path. No client-side router is running yet.
On static hosting, a common setup is to serve index.html for client-side routes. Once the app starts, it reads the URL and shows the project view. Without that fallback, the host may return a 404 because there's no file at /projects/17. Keep the fallback separate from API and asset requests so a missing script or endpoint doesn't return the app's HTML instead of an error.
When the trade-off makes sense
SPAs are useful for interfaces people work in for a while, such as editors and dashboards. They can keep a sidebar mounted or retain filters while users move between a list and a detail view. The trade-off is that a large JavaScript bundle can delay the first usable screen. Loading code by route can reduce that upfront cost. The app also needs to handle details that a new document load would normally address, such as updating the page title and moving focus when appropriate after navigation.
What interviewers look for
Be ready to explain a click inside the app, a refresh on the same URL, and a Back navigation. Also keep rendering separate from routing: server-side rendering (SSR) can provide the initial HTML, while client-side routing takes over after hydration. An SPA doesn't have to start with an empty HTML shell.