Faster, more reliable video uploads with Expo Modules
Key Points
- Native background uploads with Expo Modules
- AWS S3 multipart uploads with presigned URLs
- ~20% faster uploads; no stuck uploads
Summary
Boom replaced a JavaScript-only uploader with a native-backed pipeline using Expo Modules. A SharedObject-based UploadTask (exposed from native iOS/Swift and used from TypeScript) performs long-lived background uploads, handles chunking, concurrency, and retries, and uploads parts to AWS S3 multipart presigned URLs. The JS layer orchestrates: preProcess(), request presigned URLs from the backend, set clipUrls/coverUrl/completionUrl, subscribe to onProgress, then await upload().
Key Points
- Goals: improve speed and resilience for large mobile video uploads (survive app backgrounding and network hiccups).
- Architecture: Expo Modules + SharedObject provides native long-lived tasks with a small JS surface (UploadTask with preProcess, parts, clipUrls, completionUrl, coverUrl, upload(), and onProgress events).
- Backend role: return presigned S3 multipart upload URLs and a completion URL; client uploads parts in parallel with retries.
- Integration tips: keep the heavy work (chunking, retries, background continuation) in native code; keep orchestration and UI events in JS.
- Results: ~20% median end-to-end time improvement for 100–300MB clips and no "stuck" uploads in tests.
- Maintenance: Expo Modules required less boilerplate than TurboModules and integrates smoothly with Expo projects, lowering long-term cost.
Practical checklist for engineers
- Implement a long-lived native upload task (SharedObject) exposed via an Expo Module class.
- Add a preProcess step to split files into parts and expose parts length to request presigned URLs from the backend.
- Use S3 multipart uploads with per-part presigned URLs and a completion endpoint.
- Emit progress events to JS and make upload() an async native method that handles retries, concurrency, and background execution.
- Monitor metrics: end-to-end time (tap → backend confirm) and failure/stuck rates after deployment.