Skip to content

Fastly Guide (Unofficial)

This is an unofficial companion guide to using Fastly Compute@Edge.

It builds on the official Fastly documentation with an additional focus on:

  1. Quick Start Guides to get a "Hello World" app working quickly
  2. Day 2 usage to make everything as programmable as possible for creating services, packaging, uploading and activation.
  3. Management Console usage for various operations including creating services, uploading packages, and activating services.

What is Compute@Edge?

Compute@Edge lets you deploy lightweight, fastly to run, serverless code at the edge, in the form of WebAssembly (Wasm) packages. The WASM packages are standard definition files that use the WebAssembly System Interface (WASI).

See more on the Fastly Product page and this guide's FAQ.

Deployment Process

There are generally 5 steps for deploying code at Fastly's Edge, some of which can be combined and reordered by some tools such as the Fastly CLI.

  1. Create the fastly.toml file
  2. Create the WASM binary
  3. Create the Edge Code package tarball
  4. Upload the Edge Code package tarball
  5. Activate the service

Prerequisites include:

  1. Create an account
  2. Create a Compute@Edge service
  3. Add a domain
  4. Add TLS certificate, which is required for Compute@Edge

Note: Compute@Edge requires TLS for connections. Free TLS is provided for Fastly subdomains, but a paid account is required to use your own domain.

Edge Code Language Support

Code can target WebAssembly in a variety of languages. The following are available with support from Fastly and the community.

  1. JavaScript (Fastly): reference, NPM
  2. AssemblyScript (Fastly): reference, NPM
  3. Rust (Fastly): reference
  4. Swift (community): repo
  5. Zig (community): repo

Fastly's support team offers support on Fastly SDKs, while community projects are supported by their author's and the community. See the community SDKs page for general info on how to use these.

For a discussion on new language support, including Go, check out the article on Evaluating new languages for Compute@Edge.

Deployment Options

Fastly offers several ways to deploy Fastly edge code packages to production.

  1. Fastly CLI - an easy way to create and upload packages manually
  2. Fastly Management Console - upload packages via drag-and-drop from your filesystem
  3. Fastly API - upload packages via Fastly's "Upload a Compute@Edge package" API
  4. Fastly API Client SDK for Go - upload packages via the UpdatePackage function
  5. Fastly API Client SDK for JavaScript - upload packages via the putPackage function
  6. Fastly API Client SDK for PHP - upload packages via the putPackage function

See the Deployment page for more information on these approaches. The Packaging page covers the service package file format, along with approaches to create the service package.

Fastly also provides API Client SDKs in Python, Ruby, and Perl. To request Upload Package API support, please post a GitHub Issue for their respective GitHub repositories.

Local testing can be done using Viceroy.