Deployment
Kilat deploys to Cloudflare Workers — serverless, no Docker, no VPS, no load balancer to configure. Your app runs across 300+ edge locations automatically.
The three-command deploy
Section titled “The three-command deploy”# 1. Build the client bundle (esbuild → dist/)bun run build
# 2. Apply D1 migrations to the remote databasewrangler d1 migrations apply kilat --remote
# 3. Deploy the Workerwrangler deployThat’s it. wrangler deploy uploads the Worker bundle and routes traffic
globally within seconds.
What happens at the edge
Section titled “What happens at the edge”- Worker — your Hono app runs at the nearest of 300+ Cloudflare locations to each visitor. No cold starts in the traditional sense; Workers isolate startup is sub-millisecond.
- D1 — your SQLite database replicates read-only copies to the nearest edge. Writes go to the primary, reads hit the local replica — low latency without managing replicas yourself.
- Static assets —
dist/is served via the Workers Static Assets binding (env.ASSETS).run_worker_first = ["/*", "!/assets/*"]means/assets/*bypass the Worker entirely for maximum speed; everything else hits your app first.
No Docker, no VPS
Section titled “No Docker, no VPS”There is no container to build, no server to provision, no process manager to keep alive. Wrangler handles upload and global distribution. You never SSH into anything.
Before you deploy
Section titled “Before you deploy”- Set your secrets —
wrangler secret putforRESEND_API_KEY,GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET, etc. See Configuration. - Set
APP_URLinwrangler.toml[vars]to your production URL — it drives email links and OAuth redirect URIs. - Set
NODE_ENV = "production"— enablessecurecookies and production behavior. - Run migrations with
--remote(not--local) — your local D1 is a separate database.
Deploying updates
Section titled “Deploying updates”Re-run the same three commands. Wrangler handles atomic swaps — in-flight requests finish on the old version, new requests hit the new one. Migrations are forward-only; never edit an applied migration (see Schema & migrations).
Custom domain
Section titled “Custom domain”Want https://yourdomain.com instead of *.workers.dev? See
Custom domain.