The Go + SQLite Stack I Actually Run in Production
People ask what a "modern Go + SQLite production stack" looks like. Here is the one I actually run, piece by piece, with the job each piece does.
The stack
| Piece | Job |
|---|---|
Go binary (modernc.org/sqlite) |
The application. One static binary, no runtime deps. |
| SQLite (WAL) | The database. A file, backed up by VACUUM INTO. |
| systemd | Keeps the process alive, restarts on crash, isolates privileges. |
| nginx | Reverse proxy: TLS, headers, static assets, rate limits. |
| Cloudflare | DNS + CDN in front, hides the origin, free TLS via proxy. |
| GoAccess | Analytics from the nginx logs — no third-party script on the site. |
| Backups | Daily VACUUM INTO + weekly restore test. |
Why each piece earns its place
- systemd over a process manager: the unit file is declarative —
Restart=on-failure,ProtectSystem=full, a dedicated user, anEnvironmentFilefor secrets. It is the boring, reliable choice on any Linux box. - nginx over exposing the Go port: the app listens on
127.0.0.1, nginx terminates TLS and sets the client headers the app trusts. If nginx is your only exposed surface, the app has less to defend. - Cloudflare: DNS and CDN are free; TLS becomes "toggle the proxy" instead of a certbot ritual. The origin IP stays hidden.
- SQLite + WAL: zero-ops storage for a single-node service. No server to administer, no connection pool to babysit — just the backup discipline I keep repeating.
What it costs
A modest single-node setup runs on a ~$5–6/month VPS, with Cloudflare free and GoAccess free. Compared to managed alternatives, the dollar cost is small — the real cost is that you are the SRE: patches, disk, log rotation, and "why is the box slow" are all on you.
What I would change at scale
When this stops being enough, the tell-tale signs are: multiple concurrent writers, a need for replicas/failover, or data size that outgrows a single file. That is when the honest answer is Postgres behind a managed service — not more heroics around a single SQLite file.
Run the numbers on your own workload with the calculator below before you choose a path.
Comments (0)
No comments yet.