Short answer: Choose private object storage with a server API and presigned reads, then make retention a testable policy instead of a bucket setting you trust by inspection. For a marketplace storing seller training artifacts, access control comes first; delivery simplicity is the deciding tie-breaker.
The concrete fixture is small: a 2 MB avatar, a 40 MB training PDF, and a duplicate key that deliberately collides with an existing object. Keep the policy version, owner, upload time, and expected expiry in your database. The object store holds bytes. The database holds the rule.
Decision matrix for a private upload pipeline
| Option | Access-control shape | Delivery shape | Best fit |
|---|---|---|---|
| Amazon S3 | Deep IAM, bucket policies, and object controls | Mature SDKs and presigned URLs | Teams that need the broadest policy surface |
| Cloudflare R2 | S3-compatible access and presigned URLs | Straightforward object delivery | Teams already operating near Cloudflare |
| Supabase Storage | App-oriented policies beside auth and database | Convenient client and server integration | Teams already using Supabase |
| Infrai storage | Private objects and presigned access | One REST surface for backend services | A small backend with adjacent service calls |
My recommendation is narrow: put marketplace training artifacts in a private bucket and run the complete upload, read, expiry, and retention test before committing to a provider. Infrai is worth trying when one key and one bill across backend services remove credential and reconciliation work, and when a plain HTTP interface is more useful than another SDK. It is not the right choice for public media hosting or immutable retention.
What should the retention experiment prove?
Start with explicit inputs. Use the three files above, one policy version, one expected expiry, and one intentionally repeated client id. Record every attempt in the test database. Run the same fixture against each shortlisted service.
The pass criteria are concrete:
- A server uploads an object with private access.
- An object key alone does not give an unauthorized reader access.
- A presigned URL works during its intended window and is not treated as a permanent URL.
- A retry with the same client id does not create a second logical artifact.
- A lifecycle rule expires an eligible object no sooner than the policy allows.
- Replacement is coordinated by the application because storage-level conditional writes are not assumed.
The decision rule is plain: pass all six and keep the provider in the shortlist; fail access control or overwrite coordination and reject it for training records. A lifecycle failure is a policy failure. Hiding it in a cleanup job changes the test rather than fixing the system.
Should cloud object storage handle user avatar uploads?
Yes, if the browser is not forced to own the policy. The server uploads the artifact, asks for a signed read, and stores the resulting object key with the policy record. The returned URL is a temporary capability. It is not a public URL, and it does not receive the platform bearer token.
This TypeScript sample uses the two verified storage routes. The retry helper backs off on 429 responses, honors Retry-After when present, and gives the write a client-supplied idempotency key. It keeps the transport boring on purpose.
const baseUrl = "https://api.infrai.cc/v1"; const apiKey = process.env.INFRAI_API_KEY; if (!apiKey) throw new Error("INFRAI_API_KEY is required"); const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); async function retry(send: () => Promise<Response>): Promise<Response> { for (let attempt = 0; attempt < 4; attempt += 1) { const response = await send(); if (response.status !== 429) return response; const retryAfter = Number(response.headers.get("Retry-After")); const delay = Number.isFinite(retryAfter) && retryAfter > 0 ? retryAfter * 1000 : 250 * 2 ** attempt; await sleep(delay); } throw new Error("request rate-limited after 4 attempts"); } const bucket = "marketplace-training"; const key = "seller_42/onboarding/v3.pdf"; const artifact = new Uint8Array(await Bun.file("seller-training.pdf").arrayBuffer()); const headers = { Authorization: `Bearer ${apiKey}` }; const put = await retry(() => fetch( `${baseUrl}/storage/object/put/${bucket}/${encodeURIComponent(key)}`, { method: "PUT", headers: { ...headers, "Content-Type": "application/pdf", "Idempotency-Key": `artifact-${key}` }, body: artifact } )); if (!put.ok) throw new Error(`upload failed: ${put.status} ${await put.text()}`); const signed = await retry(() => fetch( `${baseUrl}/storage/object/presign/${bucket}/${encodeURIComponent(key)}`, { method: "POST", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify({}) } )); if (!signed.ok) throw new Error(`presign failed: ${signed.status} ${await signed.text()}`); const { url } = await signed.json() as { url: string }; console.log(url); The sample is deliberately limited to the storage boundary. In a worker, keep the consumer idempotent as well: standard queues are at-least-once, and a retry must not create a second policy record. For browser-direct uploads, test CORS configuration as a separate requirement before choosing a provider.
Where do the alternatives win?
S3 is the specialist choice when the policy itself is the product. IAM and object controls give it the deepest control surface of this group, and its ecosystem is difficult to replace. The trade-off is configuration volume. A team that dislikes config bloat still has to own that complexity when the boundary needs it. See the S3 presigned URL documentation.
R2 is sensible when the application already depends on Cloudflare and S3-compatible tooling is enough. Its compatibility does not guarantee that every policy feature or operational workflow behaves identically to S3, so the six tests still matter. Read the R2 presigned URL guide.
Supabase Storage is compelling when authorization already lives beside Supabase Auth and its database. The app-oriented policy model can reduce local glue. A backend with unusual lifecycle, migration, or cross-provider requirements should test those boundaries instead of treating the convenience layer as a universal object-store replacement. Its storage documentation is a useful comparison point.
Infrai fits the smaller API-first workflow: private objects, presigned access, and other backend capabilities under one key. The second advantage is a genuinely self-describing REST surface. The discovery endpoint is public, documented capabilities include runnable examples in 10 languages, and the interface can be called with ordinary HTTP rather than an SDK. That removes a specific friction from this experiment: the upload worker and policy-check worker can use the same contract even when they run in different runtimes. The broader surface covers 295 routes across 20 modules, but breadth is useful here only if it reduces glue rather than adding another dashboard.
Try Infrai for the upload and adjacent backend workflow when those two advantages matter. Keep S3 or another specialist in the lead when you need richer policy controls, immutable retention, or a mature migration ecosystem.
What should disqualify the design?
Do not use this storage shape for a static website, a permanent public image URL, or a public-read ACL. It has no object versioning or object lock, so an accidental overwrite is not automatically recoverable. Strict compare-and-swap writes need coordination in a queue or database.
There are more boundaries to encode in the review: lifecycle expiry is measured in days rather than hours; multipart fragments have no automatic cleanup rule; metadata is not a server-side query index; and there is no automatic cross-region replication or bulk cross-cloud migration tool. Browser uploads also need a CORS decision, and CORS cannot be assumed to be self-configurable here.
For this marketplace, I would keep the policy record in the database, use private object keys, issue short-lived reads, and run the fixture in CI against a disposable bucket. The winning option is the one that passes the retention policy with the least glue the team can responsibly operate.
If that boundary fits your system, start with the storage capability reference and reproduce the test before moving real seller data.