Documentation menu

Deploy any Go app on Light Cloud - net/http or any framework, compiled into a container on port 8080 with sub-second cold starts.

Deploy Go

Any Go module deploys without a framework - plain net/http included. Detection reads your go.mod, the generated image compiles the module and ships the binary, and the default port is 8080.

Serve it#

Listen on the routed port - PORT is set to it:

port := os.Getenv("PORT")
if port == "" {
    port = "8080"
}

http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("up"))
})
log.Fatal(http.ListenAndServe(":"+port, nil)) // binds 0.0.0.0

Log with the standard library or slog to stdout/stderr - both land in runtime logs.

Configuration and database#

Read environment variables with os.Getenv at startup. DATABASE_URL from the Credentials tab works with pgx and database/sql; keep sslmode=require.

Why Go loves this platform#

A compiled binary cold-starts in well under a second, so scale to zero is close to free - previews and low-traffic APIs cost nothing while idle and answer promptly when hit.