Single Page Web Applications, Javascript and the Proliferation of APIs

This guest post comes from Steven Willmott. Steven is the CEO of 3scale networks, a company that provides infrastructure services for a wide variety of APIs.

In a post over at PandoDaily last week there was some discussion about the trend towards Single Page Web Applications (SPAs) that seems to be emerging especially for SAAS Web Applications (see Zendesk's great post on Techcrunch last week). Single Page Web Apps are just starting to gain currency, but may end up playing a major role in API adoption since they essentially eliminate the need for “page based” navigation within an application. Instead, SPAs rely on a combination of an API and Javascript to create the user experience. It also seems likely that this trend might eventually extend even to content Web sites, not just functional applications (some thoughts on this here: The Death of the Web Page.

Although these articles focused on “technical” transformation, in reality these trends are a driven by a combination of technical and business factors:

New frameworks (and new browsers) are only now genuinely making it possible to build and maintain Single Page Web Apps easily. While SPAs have been around for quite some time (Google Gmail was one of the first widely adopted SPA Applications), their Javascript heavy nature has meant that maintenance and performance have been significant issues until now.

On the business side, companies are now increasingly under pressure to operate a multi-channel model and offer access to their customers on a wide variety of devices and operating systems, as well as via a range of distribution partners.

SPA makes Web Applications function in a manner which is much closer to that of native mobile application than to the structured tree of content typical for a Web page driven model. This change not only makes it easier to share code and interfaces across Web and mobile clients, it also means that the underlying API driving both mobile and Web application can become more uniform.

At a business level, conversations can also be recast from "how is our Android App doing? How is our iOS App doing?" to "How much volume is being driven to our API - and where is it coming from?". The individual Apps remain very important, but they are also acting more as transient interfaces to the underlying service. A good example of this is Evernote, which has excellent mobile applications but the real sale is plugging a customer into the Evernote underlying platform and being accessible on every device.

Accelerating API Adoption

The utility of a powerful API is that enables a company to separate its core service offering from the various interfaces and channels through which users can experience it. The concept of an API feeding multiple usage channels is simple to conceive, but very hard to accomplish in practice. SPA architectures however bring them one step closer to realization. They potentially represent a missing piece in unifying usage experience and service delivery between the Web and Mobile.

As the frameworks mature it seems likely that we'll be able to get a lot closer to running unified APIs across all interfaces than was possible before. A further change is that while APIs today are typically launched as stand-alone separate initiatives from platform clients, API launches may become part of Web Site rollout and hence become a much more frequent sight than they are today.

It's not all Good

The shift to SPAs is not universally seen as a good thing - see John Alsopp’s excellent In Defense of HTML presentation on the potential damage a full scale shift to arbitrary Javascript sites may do (hat tip to Apigee’s Marsh Gardiner for sharing this on the Google+ API Group). Moving to APIs and Javascript removes many of the navigation and structural conventions which work "out of the box" in conventional HTML sites - while this is powerful and allows more innovation, it also opens the door to a potentially wider range of errors and poorer pages.

As commenters pointed out on the 3scale blog articles and Twitter, particularly if SPA architectures become more widely adopted for the content Web, there is a risk of creating locked down silos of content that cannot be accessed or rendered except via bespoke interfaces. In essence, the exact opposite to what APIs are supposed to enable and a radical step back from today's open Web.

This is certainly a very real danger - APIs today typically require carefully constructed custom code for access. However, there is hope in that if HTML5 + Javascript remains at the core of SPA Applications as the core language for rendering interfaces they can be implemented widely. As the architectural pattern becomes more common, hopefully responsible usage patterns will accumulate and avoid a slide into Silo which already exist to a large extent on Mobile.

So What now?

While this is an interesting trend, the real questions are really "how does this affect implementation choices today?" and "does this mean we need to go SPA right away?". It is hard to know where to come down on this, and in many cases it probably makes sense to hold off moving to Single Page Applications for a while – at least until tool sets and conventions begin to standardize. This is particularly true for content oriented sites since SEO issues remain largely unresolved.

However, the overall trends seems strong enough to begin planning for. There are some things that can be done to prepare:

Re-assess your API strategy: evolve the API to become a common root for as many of the interfaces you have out in the field, including your Web site.

Take a close look at authentication and security in particular: migrate to solutions such as openAuth sooner rather than later, in order to have a uniform approach in place once Web interfaces become more App like.

Plan out your API business model: it's often the case that different interfaces are "attached" to different business models: Web to final transactions, mobile for enhanced experiences or distribution, API for "wholesale" work with partners. However, it is potentially the case that API can be structured so as to become the default transaction layer underpinning all of these business models.

No doubt, these items are already on the agenda for many companies, but Single Page Applications might be yet another reason to accelerate this thinking!