Security

KeyRouter is self-hosted, that puts the security responsibility on you. Make these three changes before doing anything else.

Before you go beyond localhost

  • 1.Change the initial password. The default password (if not already changed) is a known value. Change it at first login.
  • 2.Set a strong JWT_SECRET. Use a long random value from a password manager.
  • 3.Don't expose the port to the public internet without a reverse proxy, TLS, and auth in front of it.

data_objectRequired environment variables

For production, at minimum set these in your environment or .env:

.env (required)
JWT_SECRET=change-me-to-a-long-random-secret
INITIAL_PASSWORD=change-me
DATA_DIR=/var/lib/keyrouter

rocket_launchDeployment recommendations

  • •Run behind a reverse proxy (Caddy, Nginx) that terminates TLS.
  • •Use a network policy to allow only your team's IPs, or put it on a VPN.
  • •Set per-key limits (token budgets and request rates) before sharing a key.
  • •Keep the data volume (DATA_DIR) backed up, it holds your config, keys and logs.