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 mainimport ( "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.
forkrail deployforkrail deploy --prodGo 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.