Skip to content

feat: add presigned URL uploads for large files#151

Merged
tristan-mouchet merged 1 commit intodevelopfrom
fix/large-file-uploads
Apr 10, 2026
Merged

feat: add presigned URL uploads for large files#151
tristan-mouchet merged 1 commit intodevelopfrom
fix/large-file-uploads

Conversation

@tristan-mouchet
Copy link
Copy Markdown
Collaborator

Summary

Add presigned URL upload flow so large files (video, audio, documents) bypass
Vercel's serverless function body size limit (4.5MB) by uploading directly to
Supabase Storage from the browser.

Changes

  • Add POST /ycode/api/files/presign route to generate signed upload URLs
  • Add POST /ycode/api/files/register route to create Asset records after direct upload
  • Update uploadFileApi to use presigned URLs for files >4.5MB, keeping server-side WebP conversion for small images
  • Extract shared upload helpers (MAX_UPLOAD_FILE_SIZE, generateStoragePath, getDisplayName, validateCategoryMimeType) to reduce duplication across upload routes
  • Refactor upload/route.ts to use shared validation and constants

Test plan

  • Upload a small image (<4.5MB) — should go through server route and get WebP conversion
  • Uploaa large video (>4.5MB, <50MB) — should use presigned URL flow without hitting FUNCTION_PAYLOAD_TOO_LARGE
  • Upload a file >50MB — should be rejected with size error
  • Verify uploaded assets appear in the File Manager with correct metadata
  • Test upload with category filter (e.g., videos-only) — wrong types should be rejected

Bypass Vercel serverless body size limits by uploading large files (>4.5MB) directly to Supabase Storage via signed URLs.
@tristan-mouchet tristan-mouchet added the Feature request A new feature request label Apr 9, 2026
@tristan-mouchet tristan-mouchet self-assigned this Apr 9, 2026
@tristan-mouchet tristan-mouchet merged commit 57ca119 into develop Apr 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature request A new feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant