---
title: Fastly Compute@Edge
slug: feature-experimentation/docs/fastly-compute-at-edge
docTags: 
createdAt: 2026-08-05T20:40:02.000Z
---

[Fastly’s Compute@Edge offering](https://docs.fastly.com/products/compute-at-edge) lets you build high-scale, globally distributed applications and execute code at the edge.

## Advantages of Compute\@Edge

- **Execute code** – No cold start on servers running around the world.
- **Exceptional user experiences** – Local development and debugging environment help increase end-user experience.
- **Enhanced security** – Isolation technology helps keep requests secure.
- **Familiar languages** – Developers can create code in familiar languages such as JavaScript and Rust.

:::hint{type="info"}
Although you can write [Fastly Compute@Edge code in various languages](https://developer.fastly.com/reference/compute/sdks/), Optimizely currently only provides a starter kit for JavaScript.
:::

## Compute\@Edge use cases

Compute\@Edge provides a fast, secure, and instant global computing platform that can be used for various use cases, such as ad targeting, content stitching, and authentication. For a complete list of use cases, refer to the [Compute@edge documentation](https://www.fastly.com/products/edge-compute/use-cases).

## Restrictions and limitations

There are various restrictions and limitations to Compute\@Edge to note when running feature flags and experiments. Refer to the [official Fastly Compute@Edge documentation](https://docs.fastly.com/products/compute-at-edge#resource-limits) for the most recent resource limitations. Also, review the [known limitations and constraints for Compute@Edge](https://developer.fastly.com/learning/compute/#limitations-and-constraints) before getting started.

## Optimizely + Fastly Compute\@Edge starter kit

This starter kit for Fastly's Compute\@Edge embeds and extends the [JavaScript SDK](docId:8h-w2Cm_Q9CrRsVQa1_0y) for you to start implementing experimentation and feature flagging for your experiences at the edge.

For a guide to getting started with Feature Experimentation generally, see the [JavaScript SDK Quickstart](docId\:eH-UMm_rOn_GdGDGLV6__).

### External calls using Fastly backend

This starter kit overrides the standard JavaScript SDK's external calls to use Compute\@Edge's fetch against registered backend endpoints. This backend setup also provides performant caching for the [datafile](docId:3LmHm4b3kTxKBuoR93KN8).

### Identity management

Optimizely's Feature Experimentation SDKs require [passing a user-provided identifier at runtime ](docId\:j0PPoMJWYbz04K76EKLUI) to drive experiment and feature flag decisions. This example generates a unique ID, stores it in a cookie, and reuses it to make the [decisions sticky](docId\:g0ydY7XzuuT9yqJzZgZuG). Alternatively, you can use an existing unique identifier available within your application and pass it in as the value for the `OPTIMIZELY_USER_ID` cookie.

### How bucketing works

See [how bucketing works](docId\:eH-UMm_rOn_GdGDGLV6__).

## How to use

### Prerequisites

You must have these prerequisites to use this start kit:

- [A Compute@Edge account and Fastly CLI installed](https://developer.fastly.com/learning/compute/).
- An Optimizely account. If you do not have an account, you can [register for a free account](https://www.optimizely.com/products/intelligence/full-stack-experimentation/).

### Get started

1. Create a new folder on your local machine and initialize a Fastly Compute\@Edge service using the [Fastly CLI](https://developer.fastly.com/reference/cli/) from the [starter kit hosted on GitHub](https://github.com/optimizely/fastly-compute-starter-kit).

```shell
fastly compute init --from https://github.com/optimizely/fastly-compute-starter-kit
```

1. Follow the wizard and provide the service name, description, and any other information.
   1. Add your `service_id` to `fastly.toml` if you want to use an existing Fastly service.
2. Update your `sdkKey` and `flagKey` in `src/index.js`. Your SDK keys are in the Optimizely application under **Settings**.
3. Build and publish:

```shell
fastly compute publish
```

1. (Optional) Tail the logs for debugging when accessing workers deployed on Fastly:

```shell
fastly log-tail
```

## Additional resources

- [Compute@Edge official documentation](https://docs.fastly.com/products/compute-at-edge).
- [Compute@Edge application code in JavaScript](https://docs.fastly.com/products/compute-at-edge).
- [Fastly Compute@Edge Starter Kit with Optimizely GitHub](https://github.com/optimizely/fastly-compute-starter-kit).
