Single Page Application (SPA)
What is a Single Page Application?
Sometimes names in Software Development are not well chosen, and that can lead to a lot of
confusion. That is certainly not the case with the term SPA: a single page application literally
has only one page!
Facebook, Gmail, and Github are highly popular examples of Single-Page Applications (SPAs). A
SPA eliminates the requirement of reloading the web page when in use by loading all the
it because SPAs do not need additional waiting time, and directly render the web pages in the
Why the SPA Architecture?
This type of applications have been around for years, but they have not yet become widespread
in the public Internet.
And why is that?
There is both a good reason for that and an even better reason on why that could change in the
SPAs did get adopted a lot over the last few years for building the private dashboard part of
SaaS (Software as a Service) platforms or Internet services in general, as well as for building
enterprise data-driven and form-intensive applications.
Why Would You Want to Build an Application as a SPA?
This is something that is often taken for granted. Everybody is building applications this way,
but what is the big advantage of that? There have to be at least a couple of killer features,
Let’s start with a feature that does not get mentioned very often: Production Deployment.
Understanding the advantages of SPA use in production will actually also answer the key
The Production Deployment Advantages of Single Page Applications
A single page application is super-simple to deploy if compared to more traditional
server-side rendered applications: it’s really just one index.html file, with a CSS bundle
Single Page Application Versioning in Production
You can configure the server that is serving SPA with a parameter that specifies which
version of the frontend application to build: it’s as simple as that!
Single Page Applications And User Experience
If you have ever used a web application that is constantly reloading everything from the server
on almost every user interaction, you will know that that type of application gives a poor user
experience due to:
• the constant full page reloads
• also due to the network back and forth trips to the server to fetch all that HTML.
A single page application solved this problem, by using a fundamentally different architectural
On a SPA, after the initial page load, no more HTML gets sent over the network. Instead, only
data gets requested from the server (or sent to the server).
The Way SPAs Work
The way that single page applications bring these benefits is linked to the way that they work
After the startup, only data gets sent over the wire as a JSON payload or some other format.
But no HTML or CSS gets sent anymore over the wire after the application is running.
The key point to understand how single page applications work is the following:
instead of converting data to HTML on the server and then send it over the wire, SPA moved
that conversion process from the server to the client.
The conversion happens last second on the client side, which gives a much-improved user
experience to the user.
I hope that this convinces you of the advantages of SPAs. If not please let me know and why
that is not the case so I can better develop some of the points.
So Why Don’t We Use SPAs Everywhere Then?
Until relatively recently, search engines like Google had a hard time indexing correctly a single
page application. But what about today?
In an official announcement, we have the information that Google search is now generally
able to crawl Ajax, but there are some reports that it’s yet not completely able to do so.
Will SPAs Become More Frequent In the Future?
Imagine an SEO friendly version of Amazon that would not refresh itself at each page reload
and with a much-improved performance and user experience: that would have likely a huge
positive impact on the time customers spend on the site!
So, the technical benefits of SEO-friendly SPAs are significant and even more so on mobile, and
we would expect that these type of SEO friendly SPA applications would become more frequent
in the future also on the public internet.