Edge Serverless Tutorials

Serverless enables developers to execute functions and run cloud compute services on an as-needed basis. Edge serverless enables the same things but with the added benefit of executing functions at the network edge, as close as possible to end users. This infrastructural evolution of cloud serverless decreases latency for a variety of applications, some of which the StackPath team has created tutorials for.

Below, you can find step-by-step tutorials for using StackPath’s serverless edge product to improve video streaming, static asset delivery, application performance, and much more.

Optimize first-frame bitrate for HLS

This tutorial shows you how to use edge serverless with HLS to deliver the right bitrate to the right device with the lowest possible delay.

Before getting started, you’ll need an origin serving a multi-quality HLS stream. This may be powered by nginx-rtmp, Mist, Wowza, Nimble, or any other media server.

[Follow Tutorial]

Use serverless as a callback endpoint

Need a quick solution to automate business processes? StackPath’s billing team did.

To automate the tracking of changes to PayPal’s Billing Agreements and update our billing system when a customer cancelled a billing agreement, StackPath’s engineers employed serverless scripts.

In this tutorial, you’ll learn how to use serverless scripts as an endpoint for accepting PayPal IPN Pingbacks and processing those requests to an internal backend system.

[Follow Tutorial]

Perform DNS over HTTPS (DoH)

Use serverless scripts at the edge to quickly respond to DNS to resolve a custom TLD.

This tutorial walks you through all the steps, from creating a simple proxy JS script to a full-fledged TypeScript script that responds to DNS queries.

By the end of the tutorial you’ll have created a simple script to respond to HTTP calls, tested the script locally behind HTTPS, set up DNS over HTTPS (i.e. Trusted Recursive Resolvers) in Firefox, used TypeScript and webpack to include Node.js modules and make a single script, and deployed the script to StackPath’s edge network.

[Follow Tutorial]

Handle JWT validation at the edge

If your services use JSON Web Tokens (JWTs) for request authentication, you can utilize edge serverless to validate tokens at the edge. Doing this ensures that only authorized requests reach your origin server, which has the added benefit of providing the user with more immediate feedback.

In this tutorial, grab the script that makes this possible and learn how to run it at the edge.

[Follow Tutorial]