Browse Chapters

Characteristics of Serverless Apps

We have untangled the knot of definitions around terms like serverless, FaaS and serverless functions. From here on out, with only a few exceptions, we will be talking about the [characteristics of serverless apps](definition-of-serverless apps). (Though we are not particularly picky about distinguishing between serverless apps and serverless functions.)

The main programming model for a serverless app involves writing a short-lived program that will be given one request. Its job is to handle that request, return a response, and quit.

The model is intended to be simple, eliminating the redundant code involved in writing full-fledged software servers. A typical JavaScript Express server requires hundreds of dependencies and hundreds of thousands of lines of dependency code just to print “hello world”. In contrast, the simplest serverless apps can handle an HTTP request with no libraries at all, and with just a couple lines of code.

For example, in Spin, it is possible to write HTTP responders without even using any imports. The simplest Swift program, for example, is just this:

print("content-type: text/html\n\nHello")

You can find many Spin app examples at the Spin Up Hub

When we think about writing serverless apps, we should think in terms of discrete units of functionality (which will become serverless functions), and how these can be grouped into an entire application. For example, the site that runs this guide is running three serverless functions in the serverless app that hosts this website:

  1. Bartholomew: The CMS that renders pages like this.
  2. Spin Fileserver: The file serving utility that sends static files like images and CSS.
  3. Spin Redirect: A simple utility that handles redirects when pages are moved.

Together, these three serverless functions make up the serverless app that runs all of Fermyon.com. (Including our official developer documentation.)

Browse Chapters

Quickstart Your Serveless Apps with Spin

Get Started