21 releases

new 0.4.0 Mar 17, 2023
0.3.2 Nov 17, 2022
0.2.14 May 23, 2022
0.2.12 Mar 9, 2022
0.1.0 Aug 24, 2020

#16 in WebAssembly

Download history 133/week @ 2022-11-27 40/week @ 2022-12-04 22/week @ 2022-12-11 26/week @ 2022-12-18 1/week @ 2022-12-25 13/week @ 2023-01-01 40/week @ 2023-01-08 99/week @ 2023-01-15 51/week @ 2023-01-22 45/week @ 2023-01-29 63/week @ 2023-02-05 114/week @ 2023-02-12 70/week @ 2023-02-19 41/week @ 2023-02-26 33/week @ 2023-03-05 86/week @ 2023-03-12

250 downloads per month

Apache-2.0 WITH LLVM-exception

6.5K SLoC


Viceroy provides local testing for developers working with Compute@Edge. It allows you to run services written against the Compute@Edge APIs on your local development machine, and allows you to configure testing backends for your service to communicate with.

Viceroy is normally used through the Fastly CLI's fastly compute serve command, where it is fully integrated into Compute@Edge workflows. However, it is also a standalone open source tool with its own CLI and a Rust library that can be embedded into your own testing infrastructure.


Via the Fastly CLI

As mentioned above, most users of Compute@Edge should do local testing via the Fastly CLI, rather than working with Viceroy directly. Any CLI release of version 0.34 or above supports local testing, and the workflow is documented here.

As a standalone tool from crates.io

To install Viceroy as a standalone tool, you'll need to first install Rust if you haven't already. Then run cargo install viceroy, which will download and build the latest Viceroy release.

Usage as a library

Viceroy can be used as a Rust library. This is useful if you want to run integration tests in the same codebase. We provide a helper method handle_request. Before you build or test your code, we recommend to set the release flag e.g. cargo test --release otherwise, the execution will be very slow. This has to do with the Cranelift compiler, which is extremely slow when compiled in debug mode. Besides that, if you use Github Actions don't forget to setup a build cache for Rust. This will speed up your build times a lot.

Usage as a standalone tool

NOTE: the Viceroy standalone CLI has a somewhat different interface from that of the Fastly CLI. Command-line options below describe the standalone Viceroy interface.

After installation, the viceroy command should be available on your path. The only required argument is the path to a compiled .wasm blob, which can be built by fastly compute build. The Fastly CLI should put the blob at bin/main.wasm. To test the service, you can run:

viceroy bin/main.wasm

This will start a local server (by default at:, which can be used to make requests to your Compute@Edge service locally. You can make requests by using curl, or you can send a simple GET request by visiting the URL in your web browser.


Since the Fastly CLI uses Viceroy under the hood, the two share documentation for everything other than CLI differences. You can find general documentation for local testing here, and documentation about configuring local testing here. Documentation for Viceroy's CLI can be found via --help.



The viceroy is a butterfly whose color and pattern mimics that of the monarch butterfly but is smaller in size.


~820K SLoC