What is a single page app?
In short
- A single page app loads one HTML page, then draws every screen with JavaScript instead of loading new pages.
- Its router changes the address bar as you move around, so each screen still has its own link.
- To open those links directly, the host has to send index.html for addresses that have no file.
A single page app, often shortened to SPA, is a website that loads one HTML page and then builds every screen in the browser. Moving from a list to a detail view doesn't fetch a new page from the server. JavaScript swaps what's on screen and fetches any data it needs. Most apps built with React, Vue or Svelte work this way, which is why they can feel quicker to move around than a site made of separate HTML pages.
A router inside the app keeps the address bar in step, so /orders/1042 shows order 1042 and the back button works. The catch comes when someone opens that address directly or refreshes. The browser asks the server for /orders/1042, and a host that only serves files has nothing there, so it answers with a not-found error. Hash routing, which puts the route after a # sign, avoids this because the browser never sends that part to the server, at the cost of addresses like /#/orders/1042.
The usual fix is a fallback that sends index.html for any address without a file. NudgeHost does this for every ZIP site, so you can host a single page app with ordinary routes and nothing to configure. A path that matches a real file still gets that file, and a missing image still returns a 404. React builds and Vue builds go up the same way, and the fallback works on sites you upload without an account too.
Related terms
Frequently asked questions
Is a single page app the same as a one-page website?
No. A one-page website puts all its content on one long page. A single page app has many screens and addresses, but loads only one HTML file and draws the screens with JavaScript.
Do single page apps need a server?
Not to serve them. The built app is a set of static files. It needs the host to send index.html for its routes, and any data it shows comes from APIs it calls in the browser.
Are single page apps bad for search?
They can be harder for search engines, because the content appears only after JavaScript runs. Sites that depend on search traffic often pre-render their pages or use a static export instead.
Put it into practice.
Drop a file and get a shareable link in seconds. Free, no card needed.