Skip to content
pantharshit007Public

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Multy R2

Personal multi-endpoint Cloudflare R2 dashboard. Client (Pages) and server (Worker) deploy independently — point the shared UI at any compatible Worker via URL + API key.

Architecture

Piece Host Role
Client Cloudflare Pages SPA; endpoint records in localStorage
Server Cloudflare Worker R2 object API, admin API, public /cdn aliases

Each endpoint record stores endPoint, apiKey, and optional customDomain. The UI sends apiKey as x-api-key to that Worker only. Multiple Workers are supported; no binding config is required in the endpoint form.

Features

  • List, upload, and delete objects on a selected Worker endpoint
  • Multi-bucket support via R2 bindings (/api/r2/bucket/:binding/...)
  • Public share URLs via Worker /cdn/... aliases
  • Optional custom domain for generated public links
  • In-app setup guide at /setup-guide

Local development

pnpm install
pnpm dev      # UI (Vite)
pnpm wr:dev   # Worker (needs R2 binding + secrets)

Local Worker endpoint

  1. Bind a bucket as R2_BUCKET or BUCKET_A in wrangler.jsonc.
  2. Set AUTH_KEY_SECRET (and PRIVATE_LINK_SECRET if using private links) in .dev.vars.
  3. Run pnpm wr:dev and pnpm dev.
  4. In the UI, add endpoint http://localhost:8787 with API key matching AUTH_KEY_SECRET.

Binding names are the identifiers used in multi-bucket URLs. Friendly labels come from wrangler.jsonc at build time (pnpm gen:bindings). Prefer UPPER_SNAKE_CASE names.

Deploy

Worker

# Configure R2 bindings in wrangler.jsonc
# Optional: D1 control plane — binding name must be DB; then apply migrations
# Secrets: AUTH_KEY_SECRET (required); PRIVATE_LINK_SECRET if using private links
pnpm deploy:worker
pnpm migrate:deploy   # only when D1 admin/control-plane routes are enabled

Pages

pnpm deploy:pages   # builds client, deploys dist/ as project multy-r2

Or connect the repo in Cloudflare Pages: build command pnpm build:client, output directory dist.

Worker bundle (shared UI users)

Paste the multi-bucket Worker from the rolling worker release, bind R2 + secrets, then add the Worker URL and API key in the UI. Full walkthrough: /setup-guide in the app.

The Release Worker Bundle action updates the rolling worker release and raw JS branch when main changes Worker source (src/server/), shared code (src/shared/), or Worker build inputs (binding generator, Wrangler config, package manifest/lockfile, TypeScript config, or the workflow itself). UI-only and documentation changes skip it. Use Run workflow with main selected in GitHub Actions to rebuild manually; other refs are skipped.

Each publication appends a commit to release-worker-js and creates a separate release tagged worker-YYYYMMDD-<run number>-<attempt> (UTC) at its source commit, including its bundle asset and source/build links. The versioned raw link points to the bundle commit. Browse release history for previous versions. The rolling worker download remains available at the same URL. History is preserved from the branch's current tip onward; commits removed by earlier force pushes are not restored. During bursts, GitHub keeps the active run and newest pending run; intermediate pending runs may be skipped.

API

Full Worker route reference: docs/api.md.

  • apiKey is the Worker secret; the UI stores it in localStorage and sends x-api-key.
  • customDomain is only for generated public URLs; if empty, public URLs use endPoint.
  • Public aliases live on the Worker (/cdn/...), not on Pages.

Credits

Original idea and inspiration: R2 Uploader by jw-12138 — browser-based R2 management with API-key auth.

Multy was created to manage multiple R2 buckets more easily. Tools like R2 Uploader work well for a single endpoint, but multi-bucket setups typically need a separate Worker per bucket, and the UI did not fit my needs.

Search indexing

The client build prerenders / and /setup-guide with page-specific metadata, canonical URLs, structured data, and a sitemap. Bucket workspaces are marked noindex; only public pages appear in the sitemap. Cloudflare Pages serves unknown paths with the generated 404 page.

For a self-hosted client, set VITE_SITE_URL=https://your-client.example before building (default: https://multy.hrshit.in). Use the client origin, not the Worker API endpoint. Run pnpm build:client && pnpm test:seo to check the generated pages. Submit /sitemap.xml to your search console after deployment.

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages