# Deploy to Deno Deploy

Drop on Deno Deploy, with a Cloudflare D1 database and an S3-compatible bucket for files, like Cloudflare R2 or Amazon S3.

[Deploy to Deno Deploy](https://console.deno.com/new?clone=https%3A%2F%2Fgithub.com%2Fvite-hub%2Fdrop)

## Deploy with the button

The official Deno button clones Drop into your GitHub account and opens the new-app flow. `deno.jsonc` sets installation, the Deno build, the server entrypoint, and D1 migrations before deployment.

1. [Create a D1 database and account API token](https://drop.vitehub.dev/docs/self-host.md#database).
2. Create an R2 bucket:

   ```
   npx wrangler r2 bucket create my-drop
   ```

   Under R2, Manage API tokens, create a token with Object Read and Write permission for that bucket. Keep its access key id and secret access key.
3. Choose an organization and app name. [Create the GitHub OAuth app](https://drop.vitehub.dev/docs/self-host.md#github) with callback `https://<app>.<org>.deno.net/api/auth/callback/github`.
4. Before deploying, open Edit Environment Variables and add all settings below. Make the D1 settings available to build and runtime; `S3_BUCKET`, `S3_ENDPOINT`, and `S3_REGION` must be available to the build. Put GitHub credentials, the auth secret, admin emails, and S3 access keys in the production runtime context.

Use a separate D1 database and bucket in preview contexts, or turn previews off. Each timeline runs migrations using its own D1 settings in the pre-deploy hook; the shared build does not migrate any database.

| Database | D1 over HTTP |
| --- | --- |
| Files | R2 S3 API |
| Rate limits | Per instance |
| Code images | SVG |
| Code image cleanup | None |

## 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 | Admin emails, comma-separated. Whoever signs in with one of them is Admin. |
| VITEHUB\_WEBHOOKS\_KEY | Seals each member's agent for Send, the URL and its secret: openssl rand -base64 32. A new key disconnects every agent. |
| VITEHUB\_MEMBERS | Optional. Only these people (and the admins) sign in, open shared links, and use MCP: github:\<id>, verified emails, @domains, or github-org:\<org>, comma-separated. |
| DROP\_MODE | Optional. team for a Drop one team runs: everyone signed in is a teammate, and new drops start shared with the Team. Defaults to personal. |
| DROP\_PUBLIC\_LINK\_DAYS | Optional. Days a public link stays open. Empty: 7 on a team Drop, no limit on a personal one. 0 turns public links off. |
| CLOUDFLARE\_ACCOUNT\_ID, CLOUDFLARE\_API\_TOKEN | Cloudflare account id and an account API token with D1 edit access. |
| CLOUDFLARE\_D1\_DATABASE\_ID, CLOUDFLARE\_D1\_DATABASE\_NAME | Your D1 database id and name. |
| S3\_BUCKET | The bucket you created, my-drop in the command above. Read at build time. |
| S3\_ENDPOINT | https://\<account-id>.r2.cloudflarestorage.com for R2. Read at build time. |
| S3\_REGION | auto for R2. Read at build time. |
| AWS\_ACCESS\_KEY\_ID, AWS\_SECRET\_ACCESS\_KEY | The bucket's access key. |

## Database

Cloudflare D1 over HTTPS. `pnpm db:migrate` (ViteHub's `vitehub database migrate`) skips migrations already applied and refuses one that would delete data. The pre-deploy hook in `deno.jsonc` runs it after the build. For a local build, run it before publishing with the target database's credentials.

To update, [pull Drop's changes into your repository](https://drop.vitehub.dev/docs/self-host.md#update) and push.

## On Deno Deploy

- Code images are SVG only: PNG needs Cloudflare Browser Run.
- Rate limits count in memory per isolate, so they're looser than on Cloudflare.
- Nothing deletes expired code images: ViteHub has no scheduled jobs on Deno Deploy yet. They stop being served after five minutes, but stay in the bucket; a lifecycle rule on `code-images/` cleans them up.
