# Deployment

Two Cloudflare Workers under the `oskar@rough.dk` account (`b29de5cf62555d67d57242aeddc91344`): the **app worker** (`apps/www`, SvelteKit + API at `https://arbe.0sk.ar`) and the **docs worker** (`apps/docs`, Astro at `https://docs.arbe.0sk.ar` / `https://arbe-docs.0skar.workers.dev`). Bot replies run in-process inside the app worker via `packages/core/dispatch/`.

```sh
cp apps/www/.env.example apps/www/.env.local                      # fill in secrets (see env-vars)
bun install
jj bookmark set main -r @ && jj git push -b main                  # ship the change you want deployed
bun run --filter '@arbe/www' --filter '@arbe/www-docs' deploy
```

App worker secrets are set once via `bunx wrangler secret put` (run from `apps/www`): `SUPABASE_JWT_SECRET`, `SUPABASE_SERVICE_ROLE_KEY`, `DURABLE_STREAMS_SECRET`, `ELECTRIC_SOURCE_ID`, `ELECTRIC_SOURCE_SECRET`, `OPENROUTER_API_KEY`. `ANTHROPIC_API_KEY` is optional and only needed for explicit direct Anthropic refs. Docs worker has no secrets — `cd apps/docs && bunx wrangler deploy`.

CLI binaries ship to Cloudflare R2 at `https://downloads.arbe.0sk.ar/` via the `cli-release` GitHub Action — see [releases](./releases.md) for the build/upload/version contract. The `arbe-downloads` bucket is on the same account with a custom domain attached via R2 → Settings → Custom Domains (no worker fronts it). Repo secrets needed: `CLOUDFLARE_ACCOUNT_ID` (the account id above — not sensitive) and `CLOUDFLARE_API_TOKEN` (Object Read & Write scoped to `arbe-downloads` only — rotate if leaked). Set both at GitHub → Settings → Secrets and variables → Actions.

Supabase auth is configured in the dashboard, not in code:
1. Auth → URL Configuration: add `http://localhost:5173/auth/callback` (local) and `https://arbe.0sk.ar/auth/callback` (prod).
2. Auth → Providers → GitHub: enable, paste Client ID + Secret from the GitHub OAuth App.
3. GitHub OAuth App callback URL: `https://<project-ref>.supabase.co/auth/v1/callback`.

Code: `apps/www/wrangler.jsonc`, `apps/docs/wrangler.jsonc`, `.github/workflows/cli-release.yml`.<br>
See [system/environment-variables](./environment-variables.md), [system/development](./development.md), [releases](./releases.md).
