Skip to content

CIRCE / DOCUMENTATION

Deployment overview

The production checklist that applies to every runtime, and how to choose where to run your bot.

Documentation menu
On this page

Pick how to run it

You have Use Guide
A VPS or dedicated server with Node.js pm2 (or systemd) Node.js and pm2
A VPS with Bun systemd or Docker Bun
Deno Tasks, Docker or Deno Deploy Deno
Containers or Kubernetes The Docker examples in each guide Any
Serverless transport: "http" Transports

What every deployment runs

circe start

It loads circe.config.ts, validates the environment, scans and validates modules, logs in, registers commands and routes interactions. On SIGINT or SIGTERM it shuts down gracefully, bounded by shutdownTimeoutMs.

Production checklist

  1. Validate in CI with circe build. It needs the environment schema but never connects to Discord. Use --format json for structured output.
  2. Keep secrets out of git. Provide DISCORD_TOKEN and friends through the process environment, a .env file next to the project (loaded automatically by the CLI), or your platform’s secret store.
  3. Unset guildId in production so commands register globally.
  4. Enable health checks: health: { port } gives /health for liveness and /ready for readiness.
  5. Run exactly one Gateway instance per bot token. Gateway connections are stateful; scaling horizontally is only for transport: "http".
  6. Let the process exit on crashes. The default onUnhandledRejection: "exit" is meant to be paired with a supervisor (pm2, systemd, Docker restart policy) that restarts it.
  7. Match the stop timeout. Your supervisor’s kill timeout must be longer than shutdownTimeoutMs (default 10 s), or it will force-kill the graceful shutdown.
  8. Persist what must survive restarts: cooldowns with SqliteCooldownStore, pagination sessions with a shared store.

HTTP transport needs HTTPS

Discord only calls an Interactions Endpoint URL over HTTPS. Put Caddy, Nginx or a Cloudflare Tunnel in front of the Circe port and paste the public URL into the Developer Portal.

Troubleshooting

Symptom Likely cause
An invalid token was provided The loaded config has no token (see Environment) or the token was reset.
Commands do not appear Missing applications.commands scope when inviting, or global registration still propagating. Set guildId while developing.
Restart loop under pm2 A startup validation error. Run circe doctor and read the first log lines.
/ready returns 503 The gateway is not connected yet, or a named health check is failing.