Skip to main content
Version: 0.5.9

Getting started

First, make sure to have Fastly's CLI installed:

The Fastly CLI is available for multiple operating systems.

  • MacOS: Install from Homebrew:

    brew install fastly/tap/fastly
  • Windows: Visit the GitHub repository to download the prebuilt binary for your architecture.

  • Linux: Packages are available for many distributions, along with prebuilt binaries. Visit the GitHub repository to download the package for your distribution.

Initialise a new project

Create a new Fastly Compute@Edge JavaScript project:

fastly compute init --language javascript --from https://github.com/fastly/compute-starter-kit-javascript-empty

Install the dependencies:

npm install

Try it out locally

fastly compute serve --watch

Your application should now be running on http://localhost:7676

/// <reference types="@fastly/js-compute" />

async function app(event) {
const request = event.request;
return new Response(`You made a request to ${request.url}`)
}

addEventListener("fetch", event => {
event.respondWith(app(event));
});