Hey Everyone! πŸ‘‹ Building a Cloudflare-Powered File Sharing App – Seeking Feedback on Architecture

Hey Everyone! πŸ‘‹
Building a Cloudflare-Powered File Sharing App – Seeking Feedback on Architecture

I’m working on a file-sharing application where users can upload files and get a shareable link for others to download or upload additional files. My goal is to make it efficient, scalable, and cost-effective using Cloudflare’s ecosystem.

High-Level Architecture:
Cloudflare R2 stores uploaded files.
Event notifications send messages to a Cloudflare Queue when a file is uploaded.
A Cloudflare Worker consumes these messages and triggers a Cloudflare Workflow to handle file transfers.
The workflow:
Initiates a multipart upload to a cheaper storage bucket.
Reads the R2 object as a stream and uploads it in chunks.
Processes parts in bulk, each bulk handled in a separate step.
Sends a complete command if successful or an abort command if any step fails.
Questions I’d Love Feedback On:
1️⃣ How many workflows can run in parallel?
2️⃣ I trigger the workflow from a worker bound to a queueβ€”how long can a workflow run?
3️⃣ What’s the best approach for handling uploads from the client?
4️⃣ whats counts for sub-requests in a workflow ?

Option 1: Upload to a worker endpoint (via Cloudflare Access) and trigger a workflow to handle multipart upload. Is this possible?
Option 2: Upload directly to R2 using se a PUT request for file under 50 MIB, for larger files use multipart upload:
(a) Temporary credentials (Access Key/Secret Key) scoped to the user's prefix (username).
(b) Pre-signed URLs (short expiration) for uploads/downloads.
(c) Worker with access for authenticated user with zero trust.

Would love to hear your thoughts! Looking forward to the discussion. πŸš€
Was this page helpful?