Skip to content

Quickstart

This page is the short version. The deploy guide explains every step, including how to back up the root key; read it before you store real secrets.

You need a Cloudflare account on the Workers Paid plan (password hashing needs more CPU per login than the Free plan allows) and openssl.

Deploy to Cloudflare

Cloudflare copies the repository to your account, creates the database and the queues, and asks for one secret, the root key. Generate it first, and back it up offline before you paste it:

Terminal window
umask 077 && openssl rand -base64 32 > anchor-root.key # ANCHOR_ROOT_KEY: back this file up offline

Leave the build and deploy commands as they are: the deploy command applies the migrations, then deploys.

Needs Node.js 22+ and pnpm. Every command runs from the repository root:

Terminal window
git clone https://github.com/sotarak/anchor.git && cd anchor
pnpm install
pnpm exec wrangler login
pnpm exec wrangler d1 create anchor # add the printed database_id to wrangler.jsonc
pnpm exec wrangler queues create anchor-reencrypt
pnpm exec wrangler queues create anchor-reencrypt-dlq
umask 077 && openssl rand -base64 32 > anchor-root.key # back this file up offline first
pnpm exec wrangler secret put ANCHOR_ROOT_KEY < anchor-root.key
rm anchor-root.key
pnpm deploy:worker # builds, applies migrations, deploys

Losing the root key makes every stored secret unreadable, permanently. Back it up before the rm, somewhere other than this machine.

Open https://<your-worker>/setup as soon as the deploy finishes and create the owner account: the first account created there owns the instance. Then create a project and its environments in the dashboard.

Terminal window
npm install -g @anchor-secrets/cli # Node.js 22.19+
brew install sotarak/tap/anchor # macOS and Linux
curl -fsSL https://sotarak.github.io/anchor/install.sh | sh # standalone binary

Pick one. The CLI guide also covers release binaries.

Terminal window
anchor login --api-url https://<your-worker> # approve the code in the browser
cd my-app
anchor init # pick the project and default environment
anchor secrets set DATABASE_URL # hidden prompt
anchor run -- npm start # npm start sees DATABASE_URL

anchor login opens the dashboard in your browser and shows a code; check that the code on the page matches your terminal, then Approve. Over SSH or in a container, open the printed URL on any device. anchor login --with-password keeps the email and password prompt.

Next steps: the CLI guide, using Anchor in CI, and rate-limiting the auth endpoints.