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 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. Keep the account id, token, database id, and database name ready.
  2. Choose a site name and create the GitHub OAuth app with callback https://<site>.netlify.app/api/auth/callback/github.
  3. Fill the form with those settings, a generated auth secret, and your GitHub user id. If the generated site address differs, update the OAuth callback.
DatabaseD1 over HTTP
FilesNetlify Blobs
Rate limitsPer instance
Code imagesSVG
Code image cleanupScheduled function

Settings

VariableWhat it is
GITHUB_CLIENT_IDYour GitHub OAuth app's client ID.
GITHUB_CLIENT_SECRETA client secret from the same app.
BETTER_AUTH_SECRETSigns sessions and agent tokens. One per deployment: openssl rand -base64 32
DROP_ADMINSGitHub user ids that join as Admin, comma-separated: gh api users/<login> --jq .id
CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_API_TOKENCloudflare account id and an account API token with D1 edit access.
CLOUDFLARE_D1_DATABASE_ID, CLOUDFLARE_D1_DATABASE_NAMEYour D1 database id and name.
DROP_HOSTnetlify. Set in netlify.toml.

Database

Cloudflare D1 over HTTPS. pnpm db:migrate:d1 skips migrations already applied. The configured Netlify build runs it after building. Disable deploy previews or give them a separate D1 database.

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.