Custom SDKs on Compute@Edge
Because Compute@Edge is powered by the WebAssembly System Interface (WASI), you can write Compute@Edge applications in any WASI-supporting language. Though Fastly provides and recommends our official language SDKs, we welcome customers who want to bring their own build process.
WARNING: Follow the information on this page at your own risk. Because custom SDKs are not supported by Fastly, we cannot make guarantees about the safety and security of these solutions.
Using a community SDK
When using a third-party SDK, you should follow the documentation provided by the maintainers. Here are some of the community-maintained SDKs that we know about:
Fastly does not provide support for, or any assurances about the merits of, any third-party tooling that you may use to build or deploy Compute@Edge applications on Fastly.
Building your own SDK
To execute your Wasm applications on Compute@Edge (and the local testing server), you need to use our Compute@Edge hostcalls, which are defined at https://github.com/fastly/Viceroy/tree/main/lib/compute-at-edge-abi. These
.witx files define the functionality of Compute@Edge. Use them with your chosen language's WASI tooling to generate stubs or interfaces for your custom SDK to implement.
Once you have created interfaces for the WASI modules required for basic functionality (
fastly_http_body) you should be able to create a Compute@Edge application that will respond to incoming requests.
When using one of our official SDKs, a program can be compiled with fastly compute build. This will use the appropriate toolchain of your chosen language to produce a Wasm binary and then pack it with Fastly metadata into a package that can be uploaded to Compute@Edge. When using your own build process, configure your compiler to produce a Wasm binary and then fastly compute pack to package it with the Fastly metadata:
$ fastly compute pack --wasm-binary bin/main.wasm✓ Initializing...✓ Copying wasm binary...✓ Copying manifest...✓ Creating .tar.gz file...
The program can now be deployed using the standard fastly compute deploy command or can be tested locally using fastly compute serve.
Publishing your SDK
Assuming your dependencies' licenses allow for it, you are welcome to share your custom Compute@Edge SDK publicly. Be sure to make it clear that your SDK is not supported by Fastly, because it will be up to you to resolve any issues that your users may have.