API guide
Deploy a Go API from GitHub
Deploy a Gin, Chi, Echo, Fiber, or standard-library Go API from source on Shiprr with production build commands, runtime settings, logs, health checks, and rollback.
Before you start
- Your API should be in a GitHub or GitLab repository.
- Commit
go.modandgo.sum. - Your server must listen on the
PORTenvironment variable Shiprr provides. - Add a lightweight health endpoint such as
/health.
Recommended Shiprr settings
Shiprr can detect many Go projects from go.mod. For a
single API binary, use explicit settings under App → Settings → Build & Runtime.
root directory: ./
install command: go mod download
build command: go build -o app .
start command: ./app
health check path: /health If your main package is in a subdirectory, set the root directory to
that folder or build the package path explicitly, such as go build -o app ./cmd/api.
Listen on PORT
Your app should read PORT at startup and bind to 0.0.0.0. A minimal HTTP server looks like this:
package main
import (
"log"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "3000"
}
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte("ok"))
})
addr := "0.0.0.0:" + port
log.Println("listening on " + addr)
log.Fatal(http.ListenAndServe(addr, nil))
} Binding only to localhost can make the app unreachable to
health checks and routing.
Environment variables
Add production values under App → Settings → Environment variables. Saving env vars redeploys the app so new values apply to live replicas.
DATABASE_URL=postgres://...
REDIS_URL=redis://...
JWT_SECRET=change-me
APP_ENV=production Keep secrets out of Git and avoid printing secret values in logs.
Deploy
- Open the dashboard and choose Apps → New app.
- Connect GitHub or GitLab if needed.
- Select the repository, branch, region, root directory, and deploy trigger.
- Confirm install, build, start command, health check path, and env vars.
- Create and deploy the app.
New apps start with 1,000 MHz CPU and 512 MB RAM per replica. Increase CPU, RAM, or replicas if the API is CPU-bound, memory-heavy, or needs more request capacity.
Verify and debug
- Use build logs if dependency download, compile, or package selection fails.
- Use runtime logs if the app starts and then exits or cannot connect to services.
- Check the health check path if the app is running but deploy status stays unhealthy.
After the default Shiprr hostname works, attach a custom domain from the app's Domains page. Shiprr provisions HTTPS automatically after DNS points to the Shiprr target.
Rollback
If a release breaks the API, roll back from deployment/build history. Shiprr reuses the selected previous successful build, skips a source rebuild, and creates a fresh deployment attempt with current runtime settings.
Deploy your Go API on Shiprr
New accounts include welcome credit, enough to try a small app before paying.
Create account