# Deploy to Netlify

Drop on Netlify Functions, with a Cloudflare D1 database, Netlify Blobs for files, and a scheduled function that deletes expired code images.

[Deploy to Netlify](https://app.netlify.com/start/deploy?repository=https%3A%2F%2Fgithub.com%2Fvite-hub%2Fdrop)

## Deploy with the button

The button clones Drop, creates a site, and prompts for the variables described in `netlify.toml`. Netlify sets the host, builds, applies D1 migrations, and publishes. Netlify Blobs needs no setup.

1. [Create a D1 database and account API token](https://drop.vitehub.dev/docs/self-host.md#database). Keep the account id, token, database id, and database name ready.
2. Choose a site name and [create the GitHub OAuth app](https://drop.vitehub.dev/docs/self-host.md#github) with callback `https://<site>.netlify.app/api/auth/callback/github`.
3. Fill the form with those settings, a generated auth secret, and your admin email. If the generated site address differs, update the OAuth callback.

| Database | D1 over HTTP |
| --- | --- |
| Files | Netlify Blobs |
| Rate limits | Per instance |
| Code images | SVG |
| Code image cleanup | Scheduled function |

## 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. |

## Database

Cloudflare D1 over HTTPS. `pnpm db:migrate` skips migrations already applied and refuses migrations that lose existing data. A fresh database needs no override. For an upgrade that reports an intentional removal, back up the database and run `pnpm db:migrate --allow-data-loss` once after reviewing `pnpm db:migrate --dry-run`. The configured Netlify build runs it after building. Disable deploy previews or give them a separate D1 database.

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

## On Netlify

- Code images are SVG only: PNG needs Cloudflare Browser Run.
- Rate limits count in memory per function instance, so they're looser than on Cloudflare.
- Files go to a Netlify Blobs store, and Drop serves them at `/f/` after checking access.
- A scheduled function deletes expired code images every hour.
