Self-hosting
Run Statiq on your own server. Requires Go 1.22+.
Build
Clone the repository, then build the server binary:
go build -o ./statiq-server ./cmd/statiq/
Or use the provided start script which builds and runs in one step:
The start script loads a .env file if present, builds the binary, and starts the server. Environment variables already set in the shell take precedence over .env values.
Environment Variables
All configuration is via environment variables. Required variables must be set before the server starts — it exits with an error if they are missing.
| Variable |
Default |
Required |
Description |
STATIQ_DB_PATH |
./statiq.db |
No |
Path to the SQLite database file. Created automatically if it doesn't exist. |
STATIQ_LISTEN_ADDR |
127.0.0.1:8080 |
No |
TCP address the server binds to. Use :8080 to listen on all interfaces. |
STATIQ_PUBLIC_URL |
http://localhost:8080 |
No |
Public-facing URL (scheme + host). Used in email links, uploaded media URLs, and WebAuthn origin derivation. Set to your tunnel or domain URL in production. |
STATIQ_SESSION_SECRET |
— |
Yes |
32-byte hex string used to sign session tokens. Generate with: openssl rand -hex 32 |
STATIQ_ENCRYPTION_KEY |
— |
Yes |
32-byte hex string used to encrypt per-site API keys (e.g. Resend keys) stored in the database. Generate with: openssl rand -hex 32 |
STATIQ_SECURE_COOKIES |
false |
No |
Set true when serving over HTTPS. Adds the Secure flag to session cookies and sets HSTS headers. Automatically enabled when STATIQ_PUBLIC_URL starts with https://. |
STATIQ_UPLOADS_DIR |
./statiq-uploads |
No |
Directory for uploaded files (gallery images, team photos). Created automatically. Use an absolute path in production. |
STATIQ_TRUSTED_PROXY |
— |
No |
IP address of a trusted reverse proxy (e.g. 127.0.0.1 for Cloudflare Tunnel). When set, CF-Connecting-IP headers from this peer are trusted for real client IP detection. |
STATIQ_WEBAUTHN_RPID |
derived from PUBLIC_URL |
No |
WebAuthn Relying Party ID — the hostname only (e.g. example.com). Only set if your tunnel hostname differs from your RP domain. |
STATIQ_WEBAUTHN_ORIGIN |
derived from PUBLIC_URL |
No |
WebAuthn origin — full scheme + host (e.g. https://example.com). Must match exactly what the browser presents during passkey registration/login. |
STATIQ_BOOTSTRAP_EMAIL |
— |
No |
Email address for the first admin account. Only used if no users exist in the database. Safe to remove after first login. |
STATIQ_BOOTSTRAP_PASSWORD |
— |
No |
Password for the bootstrap account. Used alongside STATIQ_BOOTSTRAP_EMAIL. |
GROQ_API_KEY |
— |
No |
Groq API key. Enables AI features: email designer, theme assistant, testimonial copy improver. Leave blank to disable AI features. |
RESEND_API_KEY |
— |
No |
Resend API key. Enables outbound email (broadcasts, contact auto-replies). Leave blank to disable email features. Requires a verified sending domain in Resend. |
Cloudflare Tunnel
Cloudflare Tunnel is the recommended way to expose Statiq over HTTPS without opening ports or managing TLS certificates.
- Install
cloudflared and authenticate: cloudflared tunnel login
- Create a tunnel:
cloudflared tunnel create statiq
- Create a config file pointing
localhost:8080 to your tunnel hostname.
- Set
STATIQ_PUBLIC_URL=https://your-tunnel-hostname.example.com in your .env.
- Set
STATIQ_TRUSTED_PROXY=127.0.0.1 so Statiq trusts IP headers from the local cloudflared process.
- Start both:
./statiq-server and cloudflared tunnel run statiq
ℹ
With Cloudflare Tunnel, set STATIQ_LISTEN_ADDR=127.0.0.1:8080 (the default) to keep the server off the public internet. Cloudflare handles TLS termination.
First Login
On first start with STATIQ_BOOTSTRAP_EMAIL set, Statiq creates an admin account with that email and STATIQ_BOOTSTRAP_PASSWORD. Log in at /login. After confirming the account works, remove the bootstrap variables from your environment — they're only used when no users exist.
License Activation
Go to Settings → License in the dashboard and enter your license key. Licenses unlock all features. Without a license, some features are restricted to preview mode.
Database
Statiq uses SQLite. The database is created automatically at STATIQ_DB_PATH on first start. Migrations run automatically on every startup — there's nothing to run manually. Back up the database file regularly; it contains all your site data.