gitflarePublicPartly agent-ready50
cf-r2-drop
Drag-and-drop file sharing on Cloudflare R2: multipart uploads, expiring share links, previews, download counts, lifecycle expiry.
- LicenseApache-2.0
- LanguageTypeScript
- Last landed
0e4544fOct 20, 2026
Landing stream
| Week of | People | Agents | Missions | Reviews | Releases | Issues |
|---|---|---|---|---|---|---|
| 25 May | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 Jun | 0 | 0 | 0 | 0 | 0 | 0 |
| 8 Jun | 0 | 0 | 0 | 0 | 0 | 0 |
| 15 Jun | 0 | 0 | 0 | 0 | 0 | 0 |
| 22 Jun | 0 | 0 | 0 | 0 | 0 | 0 |
| 29 Jun | 0 | 0 | 0 | 0 | 0 | 0 |
| 6 Jul | 0 | 0 | 0 | 0 | 0 | 0 |
| 13 Jul | 0 | 0 | 0 | 0 | 0 | 0 |
| 20 Jul | 0 | 0 | 0 | 0 | 0 | 0 |
| 27 Jul | 0 | 0 | 0 | 0 | 0 | 0 |
| 3 Aug | 0 | 0 | 0 | 0 | 0 | 0 |
| 10 Aug | 0 | 0 | 0 | 0 | 0 | 0 |
| 17 Aug | 0 | 0 | 0 | 0 | 0 | 0 |
| 24 Aug | 0 | 0 | 0 | 0 | 0 | 0 |
| 31 Aug | 0 | 0 | 0 | 0 | 0 | 0 |
| 7 Sep | 0 | 0 | 0 | 0 | 0 | 0 |
| 14 Sep | 0 | 0 | 0 | 0 | 0 | 0 |
| 21 Sep | 0 | 0 | 0 | 0 | 0 | 0 |
| 28 Sep | 0 | 0 | 0 | 0 | 0 | 0 |
| 5 Oct | 0 | 0 | 0 | 0 | 0 | 0 |
| 12 Oct | 0 | 0 | 0 | 0 | 0 | 0 |
| 19 Oct | 0 | 3 | 3 | 0 | 0 | 0 |
| 26 Oct | 0 | 0 | 0 | 0 | 0 | 0 |
| 2 Nov | 0 | 0 | 0 | 0 | 0 | 0 |
| 9 Nov | 0 | 0 | 0 | 0 | 0 | 0 |
| 16 Nov | 0 | 0 | 0 | 0 | 0 | 0 |
0e4544f| Name |
|---|
| docs |
| public |
| scripts |
| src |
| test |
| .dev.vars.example |
| .gitignore |
| CONTRIBUTING.md |
| gitflare.json |
| LICENSE |
| package.json |
| README.md |
| SECURITY.md |
| tsconfig.json |
| vitest.config.ts |
| wrangler.jsonc |
README.md
cf-r2-drop
Drag-and-drop file sharing on Cloudflare. It shows R2 multipart uploads from the browser through a Worker, HMAC-signed expiring links, range-aware downloads, and a SQLite Durable Object that enforces download limits and revocation. The UI identity is "Courier at dusk": near-black with a warm amber accent.
Architecture
flowchart LR
B[Browser] -->|POST /api/uploads| W[Worker]
B -->|PUT parts/n, 4 in parallel| W
B -->|POST complete| W
W -->|createMultipartUpload / uploadPart / complete| R[(R2 FILES)]
B -->|GET /s/token, /d/token| W
W -->|verify HMAC, increment| D[Links Durable Object]
W -->|stream, Range| R
C[Cron trigger daily] --> W
W -->|delete expired| R
Signed link flow: the Worker signs objectKey.expiresAt.limit with LINK_SECRET, verifies the signature on every request, then asks the Links Durable Object to atomically count the download before streaming. See docs/ARCHITECTURE.md.
Features
- Files of 10 MB or more upload as 8 MB parts, 4 in parallel, 3 retries with backoff. Smaller files use one PUT.
- Progress, speed, pause, resume and cancel.
- Share card: copy link, expiry (1 h, 24 h, 7 d), download limit (1, 5, 25, unlimited), QR code.
/s/<token>share page with countdown, downloads left, image and PDF preview./mylists links created in this browser, with live counts and Revoke.- A daily cron deletes objects whose
expiresAthas passed.
Local development
npm install
cp .dev.vars.example .dev.vars # set LINK_SECRET
npm run dev
Tests
npm test # vitest run
npm run typecheck # tsc --noEmit
Deploy
npx wrangler secret put LINK_SECRET
npm run deploy # top level
npm run deploy:staging # --env staging
npx wrangler deploy --env production
Bucket names are cf-r2-drop-files, with -staging and -production suffixes. Create them first with wrangler r2 bucket create <name>.
R2 lifecycle rule
Delete objects after 7 days and abort incomplete multipart uploads after 1 day, using scripts/lifecycle.json:
npx wrangler r2 bucket lifecycle set cf-r2-drop-files --file scripts/lifecycle.json
The cron is the precise expiry. The lifecycle rule is the backstop.
Configuration
| Name | Kind | Purpose |
|---|---|---|
LINK_SECRET | secret | HMAC-SHA256 key for share links. Use 32 or more random bytes. Changing it invalidates all links. |
FILES | R2 binding | Object storage. |
LINKS | Durable Object binding | Download counts and revocation (SQLite). |
ASSETS | assets binding | Static UI from public/. |
ENVIRONMENT | var | dev, staging, production or preview. |
cron 0 3 * * * | trigger | Daily cleanup of expired objects. |
Limits: 5 GB per file, 100 MB per single PUT.
Costs
R2 has a free tier for storage and operations, and egress is free. Each multipart file costs one operation per part plus create and complete. Workers and Durable Objects bill by request and duration. Check Cloudflare's current pricing pages.
Screenshots
To be added.
Built with Gitflare
This project was built by coordinated agents in Gitflare. Each agent owned one part (server, UI, docs), and the parts were merged and tested together.
License
Apache-2.0. See LICENSE.