Architecture Summary

  1. Client-Side Validation
    • Runs before upload begins.
    • Validates:
      • MIME type
      • File size (≤ 1GB)
      • Duration (3s-10min)
      • Aspect ratio (9:16 ± 0.01)
    • Gives users early feedback and prevents most invalid uploads.
  2. Mux Direct Upload
    • Backend issues a signed upload URL via the Mux API.
    • Creators upload directly to Mux — Nomey never touches the raw video.
    • An upload document is created immediately to:
      • Enforce creator-tier limits
      • Track pending uploads
      • Ensure webhook idempotency
      • Recover gracefully if the client or webhook fails
  3. Upload Lifecycle & Webhooks
    • Mux emits lifecycle events (e.g. video.asset.ready, video.upload.error) to Nomey.
    • Handled via a webhook endpoint that:
      • Validates video duration, aspect ratio, and file size post-upload
      • Associates the assetId with the original upload record
      • Creates a reels document on success
      • Flags invalid uploads gracefully (e.g., invalid ratio)
  4. Reel Status & UI Updates
    • The frontend polls or is notified when the reel becomes ready.
    • Reel status is updated in real time based on webhook events.
    • Failed uploads are visible to the creator with a retry path.
  5. Async Task Handling
    • QStash is used to:
      • Schedule or retry post-upload processing
      • Trigger UI revalidation or notifications
    • Built-in retry and dead-letter queue ensures reliability

Validation Summary

LayerValidatorPurpose
ClientvalidateFileSize()Reject >1GB files early
ClientvalidateAspectRatio()Enforce 9:16 video ratio
ClientvalidateDuration()Prevent too-short or too-long videos
ServerPost-webhook validationFinal gate for content & tier enforcement
All validations are mirrored client and server-side. Client improves UX; server enforces trust.

Upload Limits

TierMax Active Reels
0 Subscribers50
1-100 Subscribers500
100+ Subscribers1000
Custom Tier (Celebs etc.)Unlimited
Reel count limits are not reduced if subscriber count drops — existing creators keep their tier until they go inactive.

Trade-Offs

AreaDecisionBenefitCost or Risk
Upload PathDirect to MuxFast UX, offloads infraCan’t reject invalids until post-hoc
Pre-Upload ChecksClient-sideLow latency, early feedbackCan be bypassed by bad actors
Processing PipelineNo intermediate storageSimpler infra, fast dev cycleLess pre-upload control
Abuse HandlingSoft-limits via logicLightweight, low overheadDoesn’t fully prevent cost exposure
Status TrackingWebhook + DB lifecycleTraceability + resilienceSlight delay in status change

Why It Works for Nomey

  • Creator uploads are KYC-gated → spam & abuse are minimized.
  • No free tier → storage is directly monetized via subscriptions.
  • Upload limits scale with subscriber count → predictable cost exposure.
  • QStash handles async workflows → reliable background processing with retries.
  • Mux handles video infra → Nomey can stay focused on product.
Invalid uploads are rare, cost little, and do not break user flow.

References