Experimental — APIs may change between releases
Run Go on Cloudflare Workers, and beyond
Your Go code compiles to WebAssembly, and workers-go bridges the JavaScript runtime APIs to idiomatic Go types.
go get github.com/syumai/workers-goOne handler, every runtime
Write a plain http.Handler. workers-go serves it on Cloudflare Workers, in the browser, on Neon Functions, and on Deno.
Cloudflare Workers
Serve http.Handler on Workers and Pages Functions, with KV, R2, D1, Queues, Cron, Durable Objects, and more.
Browser
Serve HTTP from a Go Wasm binary running inside a browser tab with the browser template.
Neon Functions
Run the same http.Handler on Neon's serverless functions platform.
Deno / Deno Deploy
Serve http.Handler via Deno.serve on Deno and Deno Deploy.
package main
import (
"fmt"
"net/http"
"github.com/syumai/workers-go"
)
func main() {
http.HandleFunc("/hello", func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "Hello, %s!", req.URL.Query().Get("name"))
})
workers.Serve(nil) // if nil is given, http.DefaultServeMux is used
}The Workers platform, from Go
Bindings and triggers for the runtime APIs — stable where it matters, experimental where the platform is still moving.
- http.Handler, unchanged
- KV, R2, D1, and the Cache API
- Queues, Cron, and FetchEvent
- Durable Objects, WebSocket, RPC, and Workflows
- TCP Sockets and Service Bindings
- Workers AI, Vectorize, and Images
Deploy your first worker in minutes
Scaffold a project from the Cloudflare template, write an http.Handler, and ship it.
Quickstart