Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In

Fastly [email protected]

Starter Kit hosted on GitHub for running Optimizely Full Stack feature flags and experiments on Fastly's [email protected] offering.

Fastly’s [email protected] offering allows you to build high scale, globally distributed applications and execute code at the edge.

Advantages of [email protected]

  • Execute code quickly – 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.



Although you can write Fastly [email protected] code in various languages, Optimizely currently only provides a starter kit for JavaScript.

[email protected] provides a fast, secure and instant global compute 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 [email protected] documentation.

Restrictions and Limitations

There are various restrictions and limitations to [email protected] to note when running Full Stack feature flags and experiments. Refer to the official Fastly [email protected] documentation for the most recent resource limitations. Also, review the known limitations and constraints for [email protected] before getting started.

Optimizely + Fastly [email protected] Starter Kit

The Optimizely starter kit for Fastly's [email protected] embeds and extends our Javascript SDK for you to start implementing experimentation and feature flagging for your experiences at the edge.

For a guide to getting started with our platform more generally, this can be combined with the steps outlined in our Javascript Quickstart here.

External Calls via Fastly Backends

This starter kit overrides the standard Optimizely Javascript SDK's external calls to use [email protected]'s fetch against registered backend endpoints. This backend setup also provides performant caching for the Optimizely Datafile.

Identity Management

Out of the box, Optimizely's Full Stack SDKs require a user-provided identifier to be passed in at runtime 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. 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.


For more information on how Optimizely Full Stack SDKs assign users to feature flags and experiments, see the documentation on how bucketing works.

How to use


You should have these prerequisites to use this start kit:

Get started

  1. Create a new folder on your local machine and initialize a Fastly [email protected] service using the Fastly CLI from the starter kit hosted on GitHub.

    fastly compute init --from
  2. Follow the wizard and provide the service name, description and any other information.

    1. a) Add your service_id to fastly.toml if you want to use an existing Fastly servce.
  3. Update your Optimizely sdkKey and flagKey in src/index.js. Your SDK keys can be found in the Optimizely application under Settings.

  4. Build and publish:

fastly compute publish
  1. Monitor logs:
fastly log-tail

Additional resources