Shipping AI-generated images at scale requires more than a simple file upload. A recent deep dive into Node.js infrastructure argues that teams must move away from single PUT requests for assets larger than a few megabytes, specifically recommending private object storage with multipart uploads for large exports. The core thesis is that retention and deletion must be application-owned workflows, not just storage configuration settings. For a 300 MB image set or a zip export from a logistics tenant, the standard single-request approach is the wrong default.

Two Paths to Production Stability

The proposed architecture offers two viable shapes: direct and brokered. In the direct shape, the Node.js worker streams bytes to storage while the API manages the multipart session. However, the brokered shape is recommended for unreliable networks or large files. Here, the worker requests signed part URLs from the API, uploads parts directly to storage without proxying every byte through the application server, and then records the completed object in a database. This approach avoids making the API a bandwidth bottleneck while ensuring that an export is only visible after the session completes.

The Brokered Workflow and Infrai Integration

The article highlights a TypeScript implementation using a brokered shape with Infrai, a backend-as-a-service provider. The code snippet demonstrates a robust uploadExport function that handles rate limiting with exponential backoff and uses an Idempotency-Key header to prevent duplicate sessions. The worker calls four specific routes: create, presign, upload, and complete. If any part fails, the system triggers an abort call to clean up incomplete fragments. This pattern keeps buckets private and returns signed retrieval URLs, ensuring that security and visibility are tightly controlled by the application layer.

Lifecycle Policies Are Not Enough

A critical operational insight is that object lifecycle policies do not automatically remove incomplete multipart parts. The author warns that storing the upload_id, tenant, object key, and start time in a durable table is essential. A scheduled sweeper must explicitly abort sessions that exceed the retention window. Completion should atomically mark the export as ready, and signed URLs should never be published before this state transition occurs. Without this explicit cleanup, incomplete uploads become expensive storage ghosts that linger indefinitely.

Honest Limitations and Alternatives

The brokered approach using Infrai is not a silver bullet. The storage option lacks public ACLs, object versioning, WORM locks, and If-Match conditions for strict write exclusion. It is unsuitable for static websites or permanent public links. For teams requiring cross-region replication or financial-grade immutability, the article suggests sticking with AWS S3, Cloudflare R2, or Backblaze B2. Infrai is best suited for small teams wanting one REST API and one bill for storage alongside other backend capabilities, provided they can handle retention logic themselves.

Key Takeaways

  • Use multipart uploads for any AI asset over 10MB to enable part-level retries.
  • Prefer brokered uploads to offload bandwidth from your Node.js API server.
  • Lifecycle rules do not delete incomplete multipart parts; build a sweeper.
  • Keep buckets private and use signed URLs for retrieval to enforce retention policies.
  • Validate that your provider supports idempotent completion calls to prevent race conditions.

The Bottom Line

If your Node.js service is choking on large AI image exports, you are likely proxying bytes you shouldn't be. Move to a brokered multipart pattern, but do not assume the storage provider handles your cleanup. The real production contract is in your database, not your bucket policy.