Deploy to Cloudflare
Drop's default host. One Worker with D1, R2, KV, rate limiting, Browser Run, and a Cron Trigger, all in your Cloudflare account.
| Database | D1 |
| Files | R2 |
| Rate limits | Workers rate limiting |
| Code images | PNG and SVG |
| Code image cleanup | Cron trigger |
| Live | drop.vitehub.dev |
What you need
- A Cloudflare account.
- Node.js 24 and pnpm.
- A GitHub OAuth app with the callback
https://<your-domain>/api/auth/callback/github. Use yourworkers.devaddress until you add a domain.
Deploy
Get the code and sign in to Cloudflare:
npx giget gh:vite-hub/drop my-drop cd my-drop pnpm install pnpm exec wrangler loginCreate the database and the bucket. Copy the database id into
CLOUDFLARE_D1_DATABASE_IDin the next step.pnpm exec wrangler d1 create vitehub-drop # prints the database id pnpm exec wrangler r2 bucket create vitehub-dropThe KV namespace for Drop's render cache has no id to fill in. Wrangler creates it on the first deploy.
Fill
.envwith the settings below:cp .env.example .envDeploy. It builds, applies the D1 migrations, and publishes the Worker with
.envas its secrets:pnpm run deploy- Add your domain to the Worker (Workers and Pages, your Worker, Settings, Domains and Routes), and make sure the GitHub app's callback uses it.
Run the smoke test:
DROP_URL=https://<your-domain> pnpm test:e2e:deployed
To deploy on every push instead, connect the repository in Workers Builds with CLOUDFLARE_D1_DATABASE_ID as a build variable. Workers Builds doesn't run migrations, so apply new ones with pnpm db:migrate:remote.
Settings
| Variable | What it is |
|---|---|
| GITHUB_CLIENT_ID | Your GitHub OAuth app's client ID. |
| GITHUB_CLIENT_SECRET | A client secret from the same app. |
| BETTER_AUTH_SECRET | Signs sessions and agent tokens. One per deployment: openssl rand -base64 32 |
| DROP_ADMINS | GitHub user ids that join as Admin, comma-separated: gh api users/<login> --jq .id |
| CLOUDFLARE_D1_DATABASE_ID | The id wrangler d1 create printed. Read at build time. |
| CLOUDFLARE_D1_DATABASE_NAME | The D1 database name, vitehub-drop by default. |
Database
D1. pnpm run deploy applies new migrations before it publishes; pnpm db:migrate:remote applies them on their own.
On Cloudflare
- Code images come as PNG (the default) or SVG. PNG uses Browser Run.
- Rate limits use Cloudflare's rate limiting binding, namespaced to the Worker's name.
- An hourly Cron Trigger deletes expired code images.
- Workers Logs is on, so every request's log line is searchable in the dashboard.