Skip to content

Self-hosted ​

Run aithorized on your own host or in your VPC: the dashboard, the API, Postgres and Redis, behind one Caddy on one domain.

What you get ​

ServiceImageRole
caddybuilt from deploy/self-hosted/app.DockerfileTLS (Let's Encrypt, or its internal CA for private names), the dashboard, and /v1 + /scim forwarded to the backend
backendbuilt from packages/backend/DockerfileREST, SSE, the phones' WebSocket, SAML and SCIM. Migrates the database at start
postgrespostgres:16-alpineSource of truth: requests, signatures, audit chain, policies
redisredis:7-alpineHot copies, nonces, locks, events across instances; rebuilt from Postgres, never persisted

Agents, phones and identity providers all use the same origin: https://<your domain>/v1. The containers talk on a private network, AITHORIZED_INTERNAL_SUBNET (default 192.168.237.0/24). Change it if it overlaps your VPC or LAN.

Run it ​

bash
cd deploy/self-hosted   # in a checkout of the aithorized repository
cp .env.example .env     # fill in every secret: openssl rand -hex 32
docker compose up -d --build

Signup is closed (new accounts need an invitation or an access code), so make the first code, sign up with it at https://<your domain>/signup#<code>, and make that account a system admin:

bash
docker compose exec backend node --import tsx db/platform-voucher.ts "First admin"
docker compose exec backend node --import tsx db/platform-grant.ts [email protected]

Further codes are made in Platform → Signup access codes. Set AITHORIZED_SIGNUP=open to let anyone sign up instead.

Then pair a phone from Devices. Point agents at it with the Connect an agent card, which shows the API URL and the policy key to pin.

Checks after the first start:

  • docker compose ps: all four services up, the backend healthy (its image checks /health inside the network; Caddy does not expose it).
  • curl -i https://<your domain>/v1/web/me answers 401 with a JSON error: the API is reachable through Caddy.
  • docker compose logs backend shows state: postgres + redis and no migration error.

The policy key ​

The backend signs every workspace's policy bundle and phone key directory with one Ed25519 key. Agents pin its public half and fail closed without a valid signature. Set it in AITHORIZED_POLICY_KEY_JWK, an Ed25519 private JWK on one line (the command is in .env.example), and keep a copy somewhere safe.

To replace it, rotate: set a new AITHORIZED_POLICY_KEY_ID and key, list the old public half in AITHORIZED_POLICY_PREVIOUS_KEYS, and give agents both public keys (the Connect an agent card lists them). Each policy is re-signed with the new key on first use, recorded as policy.key_rotated in its audit log.

Keeping the key in an HSM is not available yet. It is on the roadmap.

Upgrades and backups ​

  • Upgrade: git pull && docker compose up -d --build. Migrations are forward-only and run under a lock, so instances never race.
  • Back up the pg-data volume (or pg_dump as aithorized_owner). Redis holds nothing that is not in Postgres.
  • Never lose the policy key. Without it no agent can verify a new policy.

The policy engine, MCP proxy, SDK and hook are MIT-licensed.