S3-Compatible Object Storage, Reimagined
Cloudflare R2 is object storage without the egress fees. It's S3-compatible, globally distributed, and designed for the modern web. ProposalForge leverages R2 to provide permanent cloud storage for all generated PDFsβcompletely free thanks to zero egress charges.
Why R2 is Revolutionary
π° Zero Egress Fees
Unlike AWS S3, serving files from R2 is completely free. No surprise bills for bandwidth usage.
π S3 API Compatible
Drop-in replacement for S3. Use existing S3 SDKs, tools, and workflows without changes.
π Global Distribution
Files automatically replicated across Cloudflare's global network for fast access worldwide.
β‘ Edge Integration
Direct integration with Workers. Upload and serve files without leaving the edge network.
π Enterprise Security
11 nines of durability (99.999999999%). Your files are safer than on local storage.
π Generous Free Tier
10GB storage freeβenough for thousands of proposal PDFsβplus unlimited downloads.
How ProposalForge Uses R2 Just Implemented!
When you generate a PDF in ProposalForge, here's what happens behind the scenes:
Generate PDF
β
Download Locally
β
Upload to R2
β
Save URL to D1
β
Get Shareable Link
Upload Implementation
ProposalForge uploads PDFs to R2 using a Cloudflare Worker API endpoint:
// Client-side: Send PDF to Worker for R2 upload
async function uploadPdfToCloud(pdfBlob, filename) {
const formData = new FormData();
formData.append('file', pdfBlob, filename);
const response = await fetch('/api/upload-pdf', {
method: 'POST',
body: formData
});
const { url, success } = await response.json();
return url;
}
// Worker: Upload to R2
export async function onRequestPost({ request, env }) {
const formData = await request.formData();
const file = formData.get('file');
// Generate organized path: proposals/YYYY/MM/filename.pdf
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const key = `proposals/${year}/${month}/${file.name}`;
// Upload to R2
await env.R2_BUCKET.put(key, file.stream(), {
httpMetadata: {
contentType: 'application/pdf'
},
customMetadata: {
uploadedAt: date.toISOString(),
fileSize: String(file.size)
}
});
// Generate public URL
const url = `https://cdn.example.com/${key}`;
// Save to D1 database
await env.DB.prepare(`
INSERT INTO pdf_generations (filename, file_size, cloud_url)
VALUES (?, ?, ?)
`).bind(file.name, file.size, url).run();
return Response.json({ success: true, url });
}
File Organization Strategy
PDFs are automatically organized using a date-based folder structure:
- π proposals/ - Root folder for all PDFs
- π proposals/2026/ - Year-based organization
- π proposals/2026/01/ - Month-based subdivision
- π proposals/2026/01/acme-corp-proposal.pdf - Individual files
This structure makes it easy to browse, archive, and manage thousands of proposals over time.
R2 Features in Action
π Public URLs
Each PDF gets a permanent, shareable URL accessible from anywhere in the world.
π Metadata Tracking
Store custom metadata with each file: upload date, file size, original filename, proposal ID.
ποΈ Versioning
Keep multiple versions of the same proposal with R2's optional versioning feature.
π Access Control
Generate time-limited signed URLs for secure, temporary access to sensitive proposals.
Cost Comparison: R2 vs AWS S3
Serving 10,000 PDFs per month (average 250KB each):
π Cloudflare R2
Storage: $0 (2.5GB < 10GB free tier)
Uploads: $0 (10,000 < free tier)
Downloads: $0 (no egress fees!)
Total: $0.00/month
π΄ AWS S3
Storage: $0.06 (2.5GB Γ $0.023/GB)
Uploads: $0.05 (10,000 PUT requests)
Downloads: $225.00 (2.5GB Γ $0.09/GB egress!)
Total: $225.06/month
Technical Specifications
- π¦ Max File Size: 5TB (far more than needed for PDFs)
- π’ Max Objects: Unlimited
- β‘ Upload Speed: 100MB/s through Workers API
- π Availability: 99.9% SLA
- π Durability: 99.999999999% (11 nines)
- π API Compatibility: Full S3 API support
Advanced Features Coming Soon
ποΈ Automatic Compression
R2 can automatically compress PDFs before storage to reduce costs and improve delivery speed.
π Signed URLs
Generate time-limited URLs for secure proposal sharing with expiration dates.
π§ Email Integration
Email PDFs directly to clients using Cloudflare Email Workers with R2 attachments.
π Usage Analytics
Track how many times each PDF is viewed or downloaded using R2 access logs.
Security & Privacy
ProposalForge takes PDF security seriously:
- π Private by Default: PDFs not publicly listed or discoverable
- π Secure URLs: Long, unguessable URLs prevent unauthorized access
- π‘οΈ DDoS Protection: Cloudflare's network protects against attacks
- π Access Logs: Optional logging of who accesses each PDF
- β° Expiring Links: Generate URLs that automatically expire after X days
Free Tier Limits
- π Storage: 10GB free (β 40,000 PDFs @ 250KB each)
- π Class A Operations: 1 million/month (writes)
- π Class B Operations: 10 million/month (reads)
- π Egress: Unlimited (this is the big win!)
Why This Changes Everything
Before R2, storing and serving files had hidden costs:
- β AWS S3: Egress fees can exceed storage costs by 100x
- β Google Cloud Storage: Similar egress pricing model
- β Azure Blob Storage: Bandwidth charges add up quickly
- β
Cloudflare R2: Zero egress fees = predictable, sustainable costs