Swiftpack.co - AndrewBarba/swift-compute-runtime as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by AndrewBarba.
AndrewBarba/swift-compute-runtime 1.3.0
Swift runtime for Fastly Compute@Edge
⭐️ 15
🕓 4 weeks ago
.package(url: "https://github.com/AndrewBarba/swift-compute-runtime.git", from: "1.3.0")


Swift runtime for Fastly Compute@Edge

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 Compute@Edge

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)


Stars: 15
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

v1.3.0 - Object Store
4 weeks ago

Add support for Fastly's new Global Object Store

let store = try ObejctStore(name: "app")
let user = try await store.get("user_12345")?.json()

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics