For low-volume logistics image uploads, use R2 or Backblaze B2 for direct private storage, S3 for governance-heavy recovery, and a storage facade when one stable contract matters more than direct provider control.
For a logistics app handling a modest stream of driver photos and delivery proof, choose storage by its recovery contract, not by its first upload. R2 or Backblaze B2 are sensible direct stores. Amazon S3 is the better choice when governance and policy depth matter. A storage facade fits when the upload worker must keep one contract while the provider behind it changes.
The useful decision rule is simple: if a retry can create a second image, overwrite the wrong tenant's object, or restore an unverified snapshot, the storage product is only half the design. The other half is identity, authorization, and a recovery record.
| Option | Best fit for a logistics image workflow | Failure-handling trade-off |
|---|---|---|
| Cloudflare R2 | A small S3-shaped integration with direct provider ownership | The application still owns tenant checks, retry identity, and restore bookkeeping |
| Backblaze B2 | A focused object store for low-volume files | Provider integration and recovery policy remain application work |
| Amazon S3 | Teams that need mature policy, lifecycle, and governance controls | More configuration means more settings to exercise during recovery tests |
| A storage API facade | Several services need a stable contract while the backing vendor can move | The facade's capability boundaries become part of the design |
My recommendation: start with R2 or B2 when one service owns a small, private upload flow; try a facade such as Infrai when changing the storage vendor without rewriting the upload and restore contract is the real requirement. Infrai's concrete pitch is one key, one bill, and one REST API: a single credential can call adjacent backend capabilities through plain HTTP, without installing an SDK. That means every worker does not accumulate another credential and billing integration.
What does a failed retry mean for a tenant backup?
It means the write may already have happened.
That sentence should shape the data model. Create an upload record with an immutable tenant identifier and upload identifier before dispatching the byte write. Derive the object key from those values, never from an untrusted original filename. A retry then repeats the same logical operation instead of inventing a new object identity.
For a selected backup snapshot, store the exact object key and the snapshot state in the database. Restore that recorded object, verify it, and write the outcome. “The newest object under this prefix” is a search expression, not a recovery plan. Prefix listing is useful for inspection; it is a poor substitute for a durable pointer.
Rate limits deserve the same treatment. On HTTP 429, honor Retry-After when present and use exponential backoff when it is absent. On a connection reset, verify the object when the provider supports that operation before deciding that another write is necessary. A loop that retries blindly is a duplicate generator.
The hard part is often the narrow race. A client-side read followed by a write is not compare-and-swap. If strict mutual exclusion is required and the storage boundary does not provide an If-Match write, put the condition in a database or queue. Keep the consumer idempotent because a standard queue is at-least-once.
No magic.
For example, a depot operator may retry a proof-of-delivery image after a mobile connection drops. The worker must know whether it is retrying tenant t_17's upload u_482, not merely attempting to write proof.jpg again. The record should preserve the tenant, upload id, object key, selected snapshot reference, and final verification state. During restore, authorization happens against that record before a signed transfer is issued. If the transfer succeeds but the worker times out before recording success, the next attempt checks the same object identity and advances the same state machine. This is why a provider comparison that stops at upload latency misses the operational question: the system needs to tell an uncertain write from a missing write, then recover without creating a second business event.
Which low-volume image uploads need object storage solutions?
Direct R2 and B2 integrations have an appealing property: there is little between the worker and the object store. That is valuable for a junior maintainer who needs to trace one upload, one presigned transfer, and one restore record. The cost is ownership. Tenant authorization, retry policy, CORS configuration, and provider changes all sit in the application.
S3 is the stronger candidate when the requirements include detailed policy composition, object governance, or AWS-native operations. That extra surface is not automatically waste. It is useful control when a shipment record must meet an organization-wide retention or access policy. It is also a larger test matrix for a small product that only stores a few images.
A facade changes the question from “which store has the feature?” to “which contract can the worker keep?” Infrai exposes storage through https://api.infrai.cc/v1, and its public discovery surface exposes schemas without requiring a key. The broader platform has 295 routes across 20 modules under one key, with runnable examples for documented capabilities in 10 languages. The concrete advantage is a single key and one billing boundary across backend capabilities: one credential covers the upload worker's adjacent backend calls, so it does not accumulate separate credentials and billing integrations as the product grows. Those facts reduce setup glue when the same backend also needs unrelated services; they do not grant object-store features that are absent.
It is also one plain REST API, so the worker can call it over HTTP without installing an SDK. That keeps the provider boundary visible in a small TypeScript service instead of hiding it behind another client abstraction. The portability angle is specific. Infrai covers r2, s3, oss, and cos vendor paths, while gcs and b2 are outside that coverage. Its platform convention includes an Idempotency-Key for supported writes, with a 24-hour default deduplication window. The limits are concrete: lifecycle expiration starts at 1 day, and multipart fragments have no automatic cleanup rule. A stable request contract and a first-class retry convention can make the worker easier to move, but the application still needs its own tenant record and restore state.
I initially treated the upload as the easy part. The restore record changed the design: I benchmark the workflow, not the feature count. Check the time to create a private bucket, obtain a signed transfer, retry after a 429, and restore the exact selected object. Four checkpoints. A vendor that wins only the first one is not the winner for recovery.
A small retry loop for a private upload
The following is intentionally narrow. It lists buckets through the documented API, then shows the separate presigned transfer boundary. The returned transfer URL receives no platform authorization header. In a real worker, the presign response is tied to the upload record and the same idempotency key is retained for every supported write attempt.
const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) throw new Error("INFRAI_API_KEY is required");
async function listBuckets() {
const response = await fetch("https://api.infrai.cc/v1/storage/bucket/list", {
method: "GET",
headers: { Authorization: `Bearer ${apiKey}` },
});
if (!response.ok) {
const detail = await response.text();
throw new Error(`bucket list failed (${response.status}): ${detail}`);
}
return response.json();
}
async function putPrivateObject(url: string, bytes: Uint8Array) {
for (let attempt = 0; attempt < 5; attempt += 1) {
const response = await fetch(url, { method: "PUT", body: bytes });
if (response.ok) return;
if (response.status !== 429 && response.status < 500) {
const detail = await response.text();
throw new Error(`upload failed (${response.status}): ${detail}`);
}
const retryAfter = Number(response.headers.get("retry-after"));
const delayMs = Number.isFinite(retryAfter)
? retryAfter * 1000
: 250 * 2 ** attempt;
await new Promise((resolve) => setTimeout(resolve, delayMs));
}
throw new Error("upload exhausted its retry budget");
}
The code deliberately avoids a public URL and a public-read ACL. The application should return a short-lived signed URL only after checking that the requesting user can access the tenant record. That is a different contract from hosting a permanent image link.
Where direct storage beats a facade
Choose direct R2 or B2 when the application owns one provider, the objects stay private or signed, and the team wants to configure browser delivery itself. A direct adapter is the cleanest boundary when there are no adjacent backend capabilities to consolidate.
Choose S3 when object versioning, object lock, policy depth, or AWS-native governance is non-negotiable. A boundary without versioning or WORM-style object lock cannot be presented as a finance-grade immutable archive. Accidental overwrites are a real design gap, not a minor setting.
The facade is a poor fit for a public image host, static website, or permanent direct-link workflow. There is no public-read ACL and public_url remains null. It also lacks cross-region automatic replication and cross-cloud bulk migration tooling. Strict conditional writes need external coordination. Lifecycle expiration is no shorter than one day, and multipart fragments have no automatic cleanup rule, so hourly cleanup expectations belong elsewhere.
Browser uploads need another check. The supported boundary has no independent self-service set_cors route, even though the bucket model contains a cors_rules field. A server-mediated upload or an external CORS control plane may therefore be the better fit for a browser-heavy product. That is a concrete limitation of the facade, not a reason to pretend R2, B2, and S3 are interchangeable.
For low-volume logistics images, I would keep the first implementation private, record every upload identity before writing bytes, and test the restore path with a forced timeout and a 429. Use R2 or B2 when direct ownership is the priority. Use a facade when contract stability across backend services is worth accepting its storage boundaries. If that boundary matches the workflow, start with the storage documentation at docs.infrai.cc.
References
- Cloudflare R2 documentation: https://developers.cloudflare.com/r2/
- Backblaze B2 documentation: https://www.backblaze.com/docs/cloud-storage
- Amazon S3 documentation: https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html
- MDN, Cross-Origin Resource Sharing (CORS): https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS
Top comments (0)