Search forkrail

Search documentation, comparisons, and CLI commands.

APIs & backends
Production ready

Deploy Go on forkrail

Compile Go services and Vercel-style api/*.go handlers into static Linux arm64 binaries on Lambda provided.al2023 with cached modules and tiny cold starts.

Adapter
None (compiled static aarch64 binary)
Runtime
AWS Lambda provided.al2023 (arm64)
Detection
go.mod + main.go / cmd/api/main.go or api/*.go
Memory
256–640 MB (low footprint)
  • Web server & api/
    Supports main.go listening on PORT or Vercel api/*.go handlers
  • Static arm64 build
    Built with CGO_ENABLED=0 -ldflags="-s -w" and cached modules
  • Go toolchain detection
    Respects go / toolchain directive in go.mod and vendor/
  • 10× concurrent HTTP
    Goroutines serve up to 10 concurrent streams per worker

1. Choose a Go server or api/ handlers

forkrail supports both standard Go HTTP servers (at main.go, cmd/api/main.go, or cmd/server/main.go) and Vercel’s per-file api/*.go layout (where each file exports one func(http.ResponseWriter, *http.Request)):

package main
import (
"fmt"
"net/http"
"os"
)
func main() {
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("content-type", "application/json")
fmt.Fprint(w, `{"ok":true}`)
})
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
http.ListenAndServe(":"+port, nil)
}

2. Build flags & deploy

The builder compiles with CGO_ENABLED=0 and -ldflags="-s -w" (customize with GO_BUILD_FLAGS), uses -mod=vendor when a vendor/ directory exists, and caches Go modules across deployments.

Deploy Go service
forkrail deploy
forkrail deploy --prod
Logging note for compiled binaries

Go binaries run without a language runtime shim: stdout/stderr lines attach to the active request when one request is in flight, while outgoing HTTP calls are not automatically intercepted.

Ready to deploy your Go project inside your own AWS account?
Quickstart