Skip to main content
Fuego apps compile to a single binary, making deployment straightforward across any platform.

Building for Production

# Using Fuego CLI
fuego build

# Or directly with Go
go build -o myapp .

# With optimizations
go build -ldflags="-s -w" -o myapp .
The -ldflags="-s -w" strips debug information, reducing binary size by ~30%.

Docker

Simple Dockerfile

FROM golang:1.23-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -ldflags="-s -w" -o server .

FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /app
COPY --from=builder /app/server .
COPY --from=builder /app/static ./static
EXPOSE 3000
CMD ["./server"]

Multi-stage with Tailwind

If using Tailwind CSS:
FROM golang:1.23-alpine AS builder
WORKDIR /app

# Install Fuego CLI for Tailwind
RUN go install github.com/abdul-hamid-achik/fuego/cmd/fuego@latest

COPY go.mod go.sum ./
RUN go mod download
COPY . .

# Build Tailwind CSS
RUN fuego tailwind build

# Build Go binary
RUN go build -ldflags="-s -w" -o server .

FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /app
COPY --from=builder /app/server .
COPY --from=builder /app/static ./static
EXPOSE 3000
CMD ["./server"]

Docker Compose

version: '3.8'
services:
  app:
    build: .
    ports:
      - "3000:3000"
    environment:
      - FUEGO_PORT=3000
      - FUEGO_HOST=0.0.0.0
    restart: unless-stopped

Cloud Platforms

Fly.io is excellent for Go apps with global distribution.
# Install flyctl
curl -L https://fly.io/install.sh | sh

# Launch (creates fly.toml)
fly launch

# Deploy
fly deploy
fly.toml:
app = "myapp"
primary_region = "dfw"

[build]
  builder = "paketobuildpacks/builder:base"

[http_service]
  internal_port = 3000
  force_https = true

[[services]]
  internal_port = 3000
  protocol = "tcp"

  [[services.ports]]
    port = 80
    handlers = ["http"]

  [[services.ports]]
    port = 443
    handlers = ["tls", "http"]

AWS

Use a Lambda adapter:
package main

import (
    "github.com/aws/aws-lambda-go/lambda"
    "github.com/awslabs/aws-lambda-go-api-proxy/httpadapter"
    "github.com/abdul-hamid-achik/fuego/pkg/fuego"
)

var app *fuego.App

func init() {
    app = fuego.New()
    // Configure routes
}

func main() {
    lambda.Start(httpadapter.New(app).ProxyWithContext)
}

Google Cloud Platform

Cloud Run is ideal for containerized Go apps:
# Build and push
gcloud builds submit --tag gcr.io/PROJECT_ID/myapp

# Deploy
gcloud run deploy myapp \
  --image gcr.io/PROJECT_ID/myapp \
  --platform managed \
  --region us-central1 \
  --allow-unauthenticated
Or deploy from source:
gcloud run deploy --source .

Configuration

Environment Variables

Fuego reads configuration from environment variables:
VariableDescriptionDefault
FUEGO_PORTServer port3000
FUEGO_HOSTServer hostlocalhost
FUEGO_ENVEnvironment (dev/prod)dev
FUEGO_LOG_LEVELLog levelinfo

fuego.yaml

port: 3000
host: "0.0.0.0"
app_dir: "app"
static_dir: "static"
static_path: "/static"

# Production settings
prod:
  hot_reload: false

Health Checks

Add a health endpoint for load balancers:
// app/api/health/route.go
package health

import "github.com/abdul-hamid-achik/fuego/pkg/fuego"

func Get(c *fuego.Context) error {
    return c.JSON(200, map[string]string{
        "status": "healthy",
    })
}
Configure your load balancer to check /api/health.

Static Files

Ensure static files are included in deployment:
app.Static("/static", "static")
For Docker, copy the static directory:
COPY --from=builder /app/static ./static

Graceful Shutdown

Fuego handles SIGINT and SIGTERM for graceful shutdown automatically. In Kubernetes, configure a termination grace period:
spec:
  terminationGracePeriodSeconds: 30

Production Checklist

  • Enable HTTPS
  • Set secure headers (app.Use(fuego.SecureHeaders()))
  • Use environment variables for secrets
  • Enable CORS properly
  • Build with -ldflags="-s -w"
  • Enable response compression
  • Set appropriate cache headers
  • Use connection pooling for databases
  • Add health check endpoint
  • Configure logging level for production
  • Set up metrics collection
  • Configure alerting
  • Use graceful shutdown
  • Configure request timeouts
  • Add rate limiting
  • Set up load balancing

Next Steps