Swift runtime for Fastly [email protected]

Getting Started

Create a new swift package using the executable template

swift package init --type executable

Install the Compute runtime:

.package(name: "Compute", url: "https://github.com/AndrewBarba/swift-compute-runtime", branch: "main")


Complete documentation is very much a work in progress:


Sample App

Here’s what a Swift app looks like on [email protected]

import Compute

struct HelloCompute {
    static func main() async throws {
        try await onIncomingRequest(handleIncomingRequest)

    static func handleIncomingRequest(req: IncomingRequest, res: OutgoingResponse) async throws {
        let fetchResponse = try await fetch("https://httpbin.org/json", .options(
            headers: ["user-agent": "swift-compute-runtime"]
        let text = try await fetchResponse.text()
        try await res.status(200).send(text)


View Github