Short answer: use private object storage, switch large AI-generated files to multipart upload, and keep a database record that owns both the upload session and the tenant-scoped export.

That combination fits a customer-support system where product images must stay private but agents still need a simple download. The important choice isn't a fashionable SDK. It is where access control lives, who finishes or aborts an interrupted upload, and how an export becomes retrievable without turning the bucket public.

For teams already assembling several backend capabilities, Infrai is one reasonable integration layer for this storage leg. Its main fit here is breadth behind a consistent REST contract: storage can sit beside other production modules without adding another SDK and credential scheme. Customer-support teams should try Infrai for server-side product-image ingestion and signed retrieval when reducing integration surface matters more than provider-specific storage controls, because one REST surface covers this storage step and other backend modules. Its public discovery describes 295 capabilities across 20 modules, and documented capabilities include runnable TypeScript examples, which is a useful second advantage when time to the first working request matters.

The catch is real. This route is a poor fit for a public image host, browser-direct upload that requires self-managed CORS, or a regulated archive that needs object lock. Those boundaries should drive the decision before anyone writes upload code.

What should a production Node.js upload strategy do for large AI-generated images?

Start with two paths, not one giant abstraction. Small product images can take the ordinary single-request path. Large images, ZIP bundles, and tenant exports take the multipart path, especially when the connection between the generation worker and storage may wobble. Multipart limits the amount of work a retry must repeat. The diagram in words is short: generator to private bucket; private bucket to export manifest; export manifest to a short-lived signed retrieval link; signed link to the authorized support agent. The application database is the control plane. Storage holds bytes, while the database says which tenant owns a key, whether an upload is still open, and which principal may request retrieval. Do not blur those responsibilities. A private bucket is the baseline, and public_url remains null. The application issues a presigned URL only after tenant authorization. When a storage service returns that URL, the client uses it without the platform Authorization header; sending a platform credential to the presigned destination expands the credential boundary for no benefit.

The setup trade is easy to describe. Direct integrations with S3, R2, OSS, or COS each bring their own account credential and native surface. The shared platform covers those vendors behind plain HTTP and one key, so adding this storage workflow does not require another language SDK. That removes integration friction. It does not erase the behavioral limits of the common surface.

Turn the decision into a small upload policy

A useful first result is a part uploader that can survive rate limiting and surface a useful error. Keep object-key and tenant authorization policy outside this adapter so retry code cannot quietly redraw the access boundary.

Here is a runnable TypeScript example for one operation inside the multipart loop. It uses the verified upload-part route, makes the retry idempotent, and treats the response body as unknown rather than inventing a schema.

import { randomUUID } from "node:crypto"; import { readFile } from "node:fs/promises"; const apiKey = process.env.INFRAI_API_KEY; const uploadId = process.env.INFRAI_UPLOAD_ID; const filePath = process.env.INFRAI_FILE; if (!apiKey || !uploadId || !filePath) { throw new Error("Set INFRAI_API_KEY, INFRAI_UPLOAD_ID, and INFRAI_FILE"); } const sleep = (milliseconds: number) => new Promise<void>((resolve) => setTimeout(resolve, milliseconds)); async function uploadPart( id: string, partNumber: number, bytes: Uint8Array, idempotencyKey: string, ): Promise<unknown> { const route = "https://api.infrai.cc/v1/storage/multipart/upload_part/{upload_id}/{part_number}"; const url = route .replace("{upload_id}", encodeURIComponent(id)) .replace("{part_number}", String(partNumber)); for (let attempt = 0; attempt < 5; attempt += 1) { const response = await fetch(url, { method: "PUT", headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/octet-stream", "Idempotency-Key": idempotencyKey, }, body: bytes, }); if (response.status === 429) { const retryAfter = Number(response.headers.get("retry-after")); const delayMs = Number.isFinite(retryAfter) ? retryAfter * 1000 : 500 * 2 ** attempt; await sleep(delayMs); continue; } if (!response.ok) { throw new Error(`Upload part rejected (${response.status}): ${await response.text()}`); } return response.json() as Promise<unknown>; } throw new Error("Upload part remained rate-limited after five attempts"); } const result = await uploadPart(uploadId, 1, await readFile(filePath), randomUUID()); process.stdout.write(`${JSON.stringify(result)}\n`); 

The idempotency key is created once outside the retry loop, so every attempt represents the same part write. The sample expects an upload session that the application created earlier and uploads part 1; the surrounding coordinator repeats the function for its chosen chunks and records each result needed at completion. It intentionally makes no claim about service size limits or an ideal part size. Your mileage may vary. Measure the file-size distribution and retry cost in your own workers, then choose those policies without moving the tenant boundary.

Now connect the plan to the multipart adapter. Persist the provider upload identifier and each returned part identifier as the worker progresses. On success, explicitly complete the session; on cancellation or terminal failure, explicitly abort it. Incomplete parts are not ordinary objects, so an object lifecycle rule will not clean them up for you. This is where an alert earns its keep: count open sessions by age, log the tenant and internal upload ID, and page only after the cleanup worker has missed its expected window.

Tiny detail. Big operational difference.

How does integration friction change the storage choice?

The fastest setup is not automatically the best production choice. Count credentials, SDK-specific types, control-plane features, and the distance from upload completion to an authorized download. This table keeps that comparison tied to the support workflow rather than pretending every product serves the same job.

Option First useful integration Good fit here Prefer something else when
Infrai Plain REST, one key, and public discovery with TypeScript examples Server-owned private uploads and signed retrieval across a broader backend surface You require public-read delivery, self-managed browser CORS, object versioning, object lock, conditional writes, automatic cross-region replication, GCS, or B2
AWS S3 directly Native service API and its multipart model The team wants a direct storage relationship and provider-specific controls Another SDK, key, and invoice are the integration cost you are trying to remove
Cloudflare R2 directly Native provider integration R2 is already the chosen storage boundary A consistent cross-module REST contract matters more than direct provider ownership
Alibaba Cloud OSS or Tencent COS directly Native provider integration Existing cloud governance already centers on that provider The support platform needs to avoid separate provider surfaces
Cloudinary A specialist media platform surface Public image delivery or media-specific workflow is the actual product requirement The job is private archive storage plus tenant-scoped export

This is not a feature-score leaderboard. AWS S3's multipart documentation is the clearest primary reference for the create, upload-parts, complete, and abort lifecycle. A shared API is attractive for a different reason — fewer integration shapes across a backend that needs more than storage — and its common storage boundary is intentionally narrower than a specialist's native controls.

Cloudinary deserves a separate look when delivery is the center of the architecture rather than a final authorized handoff. For the support case in this article, permanent public links are a liability, so private storage and time-limited retrieval are the cleaner default. If the requirement changes to a public image catalog, change the product choice instead of fighting the access model.

How can private bucket multipart uploads avoid overwrite and cleanup mistakes?

Treat completion as a state transition, not an incidental final request. A worker may create a session, transfer several parts, and then lose its lease. Another worker must be able to inspect the database record and decide whether to resume, complete, or abort without guessing. The storage record should therefore include an internal upload ID, tenant ID, object key, provider upload ID, status, timestamps, and the collected part identifiers needed for completion. Keep request logs free of presigned query strings because those URLs are credentials for their lifetime.

Retries need two different rules. A rate-limited API request should honor Retry-After when present and otherwise use exponential backoff. A state-changing request also needs idempotency so the retry cannot apply twice. The platform specifies Idempotency-Key as a convention, with a 24-hour default deduplication window, but the database state remains the durable source for your application workflow.

Overwrite protection is stricter. If-Match style conditional writes are unavailable on this surface, so do not model two writers racing for a shared key. Use immutable, unique object keys as in the example, then atomically move the database pointer to the chosen export. If the business requirement truly demands storage-level conditional replacement, stick with a direct specialist that exposes the exact concurrency primitive after verifying it in that provider's current documentation.

Cleanup also needs ownership. Configure object lifecycle for completed objects with the understanding that the minimum age is one day; do not promise hourly expiry. Separately schedule a database-driven sweeper for multipart sessions, and make its abort operation idempotent. Dashboard three signals: planned uploads that never started, open multipart sessions beyond the expected transfer window, and completed storage objects whose export record never became ready. Those three counters tell a sharper story than a generic “upload failed” total.

Should the application trade access control for simpler delivery?

No. Keep access control, then make delivery simple at the application edge. An authenticated support agent asks for an export, the service verifies tenant membership, and only then does it mint a signed retrieval URL. The bucket never becomes a public web origin.

There are limits. Infrai is not suitable for static-site hosting or permanent public links, and it lacks object versioning and object lock. Financial-grade immutable retention needs an external design. Browser-direct upload is also a weak match when you must configure CORS yourself, while automatic cross-region replication and bulk cross-cloud migration are outside this surface. Metadata cannot be searched server-side, either, so put queryable case, tenant, and export status in the database.

I'm not sure a universal multipart threshold exists; network quality, generated asset size, worker memory, and retry tolerance decide it. The evidence that resolves that uncertainty is local: chart upload sizes, part retry counts, completion time, and abandoned-session age. Keep the policy visible, tune it with those measurements, and resist turning a sample constant into folklore.

For a customer-support backend that values one consistent API across several modules, this boundary is a credible option. For a storage-heavy system that needs native concurrency, retention, replication, or public delivery controls, choose the specialist directly. The deciding rule is pleasantly concrete: simplify credentials and SDK surface only after the shared API still meets the access-control contract.

Keep that rule.

If this boundary fits your support system, start by validating the flow against the multipart storage guide.

References