5 Potential Use Cases for Serverless Frameworks

Serverless frameworks, despite their name, are not really serverless. Of course, there are servers somewhere handling requests but you don’t have to worry about them. You just post a snippet of code and your hosting service takes care of the rest. But who could benefit from these new frameworks? Serdar Yegulalp over at InfoWorld takes you through five of the best uses of serverless frameworks right now.

Perhaps the most obvious use of a serverless Framework is for APIs. A RESTful API can easily be coded up and shipped to Amazon Lambda or Azure functions. The beauty of serverless frameworks is that you just need to concentrate on writing the code and deploying. Scaling the API, a common task, is taken care of. And, if the API is little used, your API server is basically free.

Next up is Webhooks. The advantages of going serverless for webhooks are similar to those for APIs: low overhead, minimal maintenance and automatic scaling. An example use is setting up a Node.js webhook to process SMS requests with Twilio. 

Another great use mentioned by Serdar is serving static content. You can store static assets like videos, images and files in S3 and guarantee low latency by integrating Cloudflare’s geolocated cache. Again, the key advantage here is scaling. 

Perhaps a less obvious use is for a single-page app. But this is simply a combination of the above three uses. If you use a Front-end JavaScript framework like Angular to build pages, you can do the rest of the work through a serverless framework, via an API and a static content server. Of course, this means building the app as a disparate set of functions but in the days of Git and GitHub this is nothing to worry about.

Lastly, Serdar emphasizes the potential for building event-driven apps with serverless frameworks. You can use something like AWS Lambda to create background jobs triggered by incoming messages from other services, effectively creating a kind of microservices architecture. For example, every time an image is to be uploaded to an S3 bucket, you could trigger a Function that adds metadata and tailors the image away from the Web server.

Serdar warns however that you shouldn’t try to force the use of serverless frameworks on your team just because they’re the hot new thing. If your app can’t be split up into independent components so easily, maybe going serverless is not the best idea for your project.

Be sure to read the next Microservices article: How to Transition Your App to a Service Based Architecture

Original Article

Build 'em now! 5 uses for serverless frameworks