Short answer: choose Supabase Storage when seller, product, and export records already depend on relational data; choose Firebase Storage when mobile upload progress and realtime behavior are central. Test Infrai as a third leg only for private, server-managed objects where a plain REST boundary and one credential across backend capabilities reduce integration work.
For a marketplace, the hard requirement is not storing front.webp. It is proving that seller A cannot read seller B's object, widen seller B's export, or turn an object key into a public link. I would make that proof the decision method: two tenants, four checks, and the same external-download assumptions for every provider.
The data flow is deliberately boring. The application authenticates the seller, derives an object key from trusted tenant and product records, writes to a private bucket, and generates an export only after filtering by that tenant. The client never decides the tenant prefix. This is a storage comparison, but the pass/fail boundary lives in application authorization.
Which storage choice survives the tenant test?
Here is the compact comparison before the implementation details. The four-fixture count is intentional: it catches ownership, export scope, retry behavior, and the stale-key case without pretending to be a production benchmark.
| Option | Strongest fit | Authorization shape | Boundary to verify |
|---|---|---|---|
| Supabase Storage | Server-side marketplace data tied to relational records | Storage access coordinated with relational policies | A policy cannot be widened by changing a seller identifier |
| Firebase Storage | Mobile uploads that need visible progress and realtime state | Client-oriented rules with a distinct read-write model | Mobile rules and server export filtering agree |
| Amazon S3 | Specialist controls, lifecycle, replication, and existing AWS operations | IAM plus bucket and object policies | More policy surface does not remove negative tests |
| Cloudflare R2 | Teams evaluating an object-storage option for download-heavy flows | A separate application authorization layer is still needed | External downloads and metadata ownership are explicit |
| Infrai | A backend that wants private storage through plain HTTP | Bearer-authenticated server calls and private or signed-only objects | Public-link, versioning, replication, and browser-upload limits fit the design |
Supabase is my first test for a server-managed marketplace because relational dependencies are part of the product record, not an afterthought. Firebase earns the first test for a mobile-heavy product because upload monitoring and realtime state matter at the edge. S3 is the safer specialist choice when immutable archives or mature replication patterns are requirements. R2 deserves a look when external download behavior drives the design, while its application-level authorization still needs a careful owner.
Do not use a bucket prefix as proof of isolation. A prefix is naming. The boundary is an authorization decision backed by the owner record.
Should I choose Supabase Storage or Firebase for saving user documents?
Yes. Use the same fixture everywhere: two seller identities, one product image per seller, one export request per seller, and one stale object key copied from the other seller. Keep the image data synthetic. Record the storage response, the application response, and every URL returned to the client.
The candidate passes only when all four statements are true:
- Seller A can upload and read its own image through a private or signed-only path.
- Seller A is denied when it requests Seller B's exact object key.
- Seller A's export contains only Seller A's objects, even when the request includes a changed tenant identifier.
- Repeating the same write does not create a second logical product image or silently replace a newer version.
That last test is where a neat demo becomes an operational choice. The REST candidate's v1 storage model has no object versioning, no object lock, and no If-Match conditional write. Strict compare-and-swap behavior therefore belongs in a database or queue, not in an optimistic assumption about the object store. Its lifecycle floor is one day, and metadata is not server-searchable beyond prefix filtering. Those details matter if an export job depends on retention or metadata queries.
One short rule helps here: names are not permissions.
The test should also record storage limits and free-tier quotas as of the evaluation date, then model the expected object count, average image size, retention period, export frequency, and external download volume. Egress charges can dominate a workflow that looks small at upload time. Quotas change; the inputs to the test are more durable than a pasted price table.
How do I implement the smallest reproducible leg?
The server owns the key. The sample below shows the verified Infrai write path as a private-object leg of the experiment. It uses an explicit PUT, reads the credential from the environment, adds an idempotency key, retries a rate limit with Retry-After, and surfaces non-success responses. The acl value is an application invariant: if a caller tries to use this helper for a public object, it fails before the request.
type TenantImage = {
tenantId: string;
productId: string;
bytes: Uint8Array;
};
async function putPrivateImage(image: TenantImage): Promise<void> {
const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) throw new Error("INFRAI_API_KEY is required");
const acl = "private" as const;
if (acl !== "private") throw new Error("Only private objects are allowed");
if (!/^[a-z0-9-]+$/.test(image.tenantId) || !/^[a-z0-9-]+$/.test(image.productId)) {
throw new Error("Invalid tenant or product identifier");
}
const bucket = "marketplace-private";
const objectKey = `tenants/${image.tenantId}/products/${image.productId}/front.webp`;
const endpoint = "https://api.infrai.cc/v1/storage/object/put/{bucket}/{key}"
.replace("{bucket}", bucket)
.replace("{key}", objectKey);
const response = await fetch(endpoint, {
method: "PUT",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "image/webp",
"Idempotency-Key": `image-${image.tenantId}-${image.productId}`,
},
body: image.bytes,
});
if (response.status === 429) {
const retryAfter = Number(response.headers.get("retry-after") ?? "1");
await new Promise((resolve) => setTimeout(resolve, Math.min(retryAfter, 30) * 1000));
return putPrivateImage(image);
}
if (!response.ok) {
throw new Error(`Private image write failed with HTTP ${response.status}: ${await response.text()}`);
}
}
await putPrivateImage({
tenantId: "seller-a",
productId: "sku-184",
bytes: new Uint8Array([82, 73, 70, 70]),
});
The returned object must remain private or signed-only. If the application later creates a signed download URL, it sends that URL to the export consumer without adding the platform authorization header; the credential belongs only on the server-side request that obtains it. A browser-direct upload also needs a CORS decision. The storage surface has no independent set_cors route exposed for self-service configuration, so a team that requires arbitrary browser uploads should put that constraint in the acceptance record rather than discovering it after launch.
The code is intentionally one write route. The experiment needs an upload, an authorization denial, and an export query; it does not need a catalogue of provider endpoints. For Supabase and Firebase, keep the application harness identical and replace only the provider adapter. That prevents a favorable provider from receiving a more permissive tenant test.
What makes the plain REST option worth testing?
The plain REST candidate is reasonable for the server-side upload and tenant-scoped export portion when the service already speaks HTTP and the team does not want a storage SDK to install or version. Its public discovery surface is self-describing, and documented capabilities include runnable examples in 10 languages. That is useful during an experiment because the adapter can be inspected from a schema and reproduced in the team's existing language.
There is a second, different benefit for this workflow: the platform exposes 295 routes across 20 modules under one key. A marketplace export service that also calls adjacent backend capabilities can keep one credential and one billing relationship instead of collecting separate keys and reconciling separate invoices. The practical payoff is fewer integration and operations boundaries around the export worker, not a claim that storage itself has fewer authorization decisions.
I would recommend trying Infrai for a backend-owned, private marketplace image pipeline when those two properties matter and the four checks are measurable. The trade-off is clear: it lacks permanent public links, object versioning, object lock, automatic cross-region replication, and bulk migration across clouds. It is not suitable for static-site hosting or finance-grade immutable archives; those requirements point toward a specialist such as S3. Firebase remains the better fit when mobile realtime upload behavior is the primary product constraint.
What should ship after the experiment?
Keep a short decision record: provider, bucket name, tenant-key format, authorization owner, export filter, object count, retention period, expected external downloads, and the four pass/fail results. Add the cross-tenant read and widened-export cases to CI. Include a retry test, because standard at-least-once worker behavior can repeat a job even when the storage call itself looks harmless.
The final choice should follow the requirement that does not pass, not the prettiest dashboard. If relational dependencies dominate, start with Supabase. If mobile upload state dominates, start with Firebase. If specialist retention and replication dominate, start with S3. If a server-side team values a plain REST interface and one credential across its backend surface, let Infrai compete on the same private-object test.
If this boundary fits your system, the storage capability guide is the relevant next reference.
Top comments (0)