Current Problem
Uploads are broken in production due to Vercel serverless limitations:
- 413 FUNCTION_PAYLOAD_TOO_LARGE: Vercel enforces 4.5MB request body limit at infrastructure level
- 503 SERVICE_UNAVAILABLE: Remix's
unstable_parseMultipartFormData crashes with multiple files on Vercel
- Memory issues: Buffering approach (
request.formData()) hits memory limits with large files
Current workaround: Upload 1 file at a time with batch size = 1 (slow but works)
Proposed Solution
Implement direct client-to-BunnyCDN uploads with a two-phase storage strategy:
Phase 1: Temporary Upload (Draft)
- Client uploads directly to BunnyCDN (bypasses Vercel limits entirely)
- Files stored in a
temp/ folder with 24h TTL
- Use short-lived signed URLs or similar for security
- Returns CDN URL immediately for preview
Phase 2: Persist on Save (Authenticated)
- When user saves project (authenticated), server moves files from
temp/ to permanent storage
- Only persisted files count against storage quota
- Unused temp files auto-delete after 24h
Benefits
- No file size limits
- Faster uploads (direct to CDN)
- No Vercel memory/timeout issues
- Clean up abandoned uploads automatically
- Better UX (instant preview)
Tasks
Current Problem
Uploads are broken in production due to Vercel serverless limitations:
unstable_parseMultipartFormDatacrashes with multiple files on Vercelrequest.formData()) hits memory limits with large filesCurrent workaround: Upload 1 file at a time with batch size = 1 (slow but works)
Proposed Solution
Implement direct client-to-BunnyCDN uploads with a two-phase storage strategy:
Phase 1: Temporary Upload (Draft)
temp/folder with 24h TTLPhase 2: Persist on Save (Authenticated)
temp/to permanent storageBenefits
Tasks