Skip to content

Production Build

Build

bash
make build

This produces:

  • bin/server — Go binary
  • web/dist/ — Static frontend assets

Deployment Checklist

  • [ ] Change jwt.secret in config.yaml to a secure random value
  • [ ] Set server.mode to release
  • [ ] Use MySQL or PostgreSQL instead of SQLite
  • [ ] Configure a reverse proxy (Nginx/Caddy) for HTTPS
  • [ ] Set environment variables for sensitive config values

Configuration for Production

yaml
app:
    name: My App
server:
    host: 0.0.0.0
    port: 8080
    mode: release           # ← important
database:
    driver: postgres
    dsn: host=db.example.com user=app password=${DB_PASS} dbname=myapp port=5432 sslmode=require
redis:
    enabled: true
    addr: redis.example.com:6379
    password: ${REDIS_PASS}
jwt:
    secret: ${JWT_SECRET}   # ← use environment variable
    expire: 24

Environment variables in DSN are expanded at runtime via os.ExpandEnv.

Reverse Proxy (Nginx)

nginx
server {
    listen 443 ssl;
    server_name app.example.com;

    ssl_certificate     /etc/ssl/app.crt;
    ssl_certificate_key /etc/ssl/app.key;

    location /api/ {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    location / {
        root /path/to/web/dist;
        try_files $uri $uri/ /index.html;
    }
}