Self-Hosted & PaaS

Gothic apps compile to plain Go binaries, so the deliverable is a server you build once and run anywhere. The gothic.Binary deploy target builds that server, and the sections below cover where to run it: Fly.io and Railway build a container from your Dockerfile, and a VPS runs the binary itself.

Build the server

Set Deploy.Target: gothic.Binary and ServeStaticFiles: gothic.EMBEDDED in your config, then run gothic deploy. It builds the front-end assets, compiles the server at .gothicCli/bin/gothic-server, and prints the instructions your config implies. No cloud is touched and no state is kept: the binary is the whole deliverable, so --action delete reports that there is nothing to destroy. It is your box, so every cache strategy is allowed (REDIS points at your own instance through CacheConfig.RedisURL, which is never printed), while gothic.CDN static files are rejected because there is no managed provider CDN on your own server.

package main

import gothic "github.com/gothicframework/core/config"

var Config = gothic.Config{
	ProjectName: "my-project",
	Runtime: gothic.RuntimeConfig{
		// Bake ./public into the binary - no sidecar public/ folder to ship.
		ServeStaticFiles: gothic.EMBEDDED,
	},
	Deploy: &gothic.DeployConfig{
		Target: gothic.Binary, // build the server binary, touch no cloud
	},
}

Run it and the output tells you what to ship:

gothic deploy --action deploy --stage dev
#   Binary built: /path/to/project/.gothicCli/bin/gothic-server (linux/amd64)
#   Assets:  the binary carries /public/* inside (go:embed). Copy this ONE
#            file to your server and run it.        (EMBEDDED)
#   Cache:   per-process memory. Bound it with Runtime.CacheConfig.MaxEntries.
#   Run:     HTTP_LISTEN_ADDR=:8080 ./gothic-server   (binds :80 when unset)

# DISK mode instead:
#   Assets:  copy the binary AND the ./public folder to your server.

Prefer the Go toolchain? After gothic deploy has generated the templ, route, and embed files (a gothic build writes them too), the same server builds with a plain go build. Cross-compile for the server's platform with GOOS and GOARCH.

# Generate the templ, route, and embed files first
gothic build

# Build the same server with the Go toolchain
go build -o gothic-server .

# Cross-compile for a Linux server from any machine
GOOS=linux GOARCH=amd64 go build -o gothic-server .

# EMBEDDED: gothic-server is the whole deploy (one file)
# DISK: ship gothic-server and the ./public folder next to it

Single-binary builds (EMBEDDED)

EMBEDDED bakes ./public into the server binary via go:embed and serves /public/* from that embed in production, so the deploy is a single self-contained file with no sidecar public/ folder to copy or mount. In dev mode (GOTHIC_MODE=dev) files are still served fresh from disk, so hot reload keeps working. Reserve EMBEDDED for self-hosting: on AWS, CloudFront and S3 serve the static assets and embedding would only bloat the Lambda. See AWS Request Signing and the cache strategies page for that path.

Run it

The server is built. Fly.io and Railway build a container from your Dockerfile and run it; a VPS runs the binary itself.

Fly.io

Fly.io runs containers on a global edge network. Install the flyctl CLI and launch your app:

# Initialize and deploy
fly launch

# Set Redis connection string
fly secrets set REDIS_URL=your-redis-host:6379

# Deploy updates
fly deploy

Fly.io will detect your Dockerfile and deploy automatically. You can also provision Upstash Redis directly through Fly.

Railway

Railway offers one-click deployments with built-in database plugins. Install the Railway CLI:

# Initialize project
railway init

# Add a Redis plugin
railway add --plugin redis

# Deploy
railway up

Railway automatically injects the REDIS_URL environment variable from the Redis plugin into your app. No manual configuration needed.

Generic VPS

For any VPS (AWS EC2, Hetzner, Linode, etc.), build on your machine and copy the binary with scp. With EMBEDDED that is the whole deploy: one file.

# From your machine: copy the built server
scp .gothicCli/bin/gothic-server user@your-server:~/

# On the server: make it executable and run it
chmod +x gothic-server
HTTP_LISTEN_ADDR=:8080 ./gothic-server

On DISK, copy the ./public folder next to the binary as well. Keep the process alive after you log out with a systemd service. For HTTPS, put Caddy or Nginx in front of your app as a reverse proxy. Caddy provides automatic HTTPS with zero configuration via Let's Encrypt.

Prefer containers? The git clone and docker compose flow is on the Docker Setup page.

Maintaining a project created with the legacy Gothic structure? Update it with the built-in migration command.