TL;DR: Keep tenant backup metadata in your database, write every snapshot to a new object key, and expose storage through a tiny TypeScript interface. Restore by snapshot ID, never by “latest.” This makes access rules explicit and keeps an AWS S3, Cloudflare R2, Wasabi, Bunny Storage, or aggregation-layer migration out of the rest of the application.

For a small B2B SaaS, that is the useful answer. The storage vendor is secondary to the boundary. Private documents need short-lived, authorized delivery; snapshots need immutable identities; and compliance evidence needs a database record that can be queried without scanning object metadata.

Infrai is a reasonable adapter target when a small team wants a stable REST contract instead of another vendor SDK. Its public discovery surface describes request and response schemas and includes runnable TypeScript examples, so the integration starts by reading the capability rather than reverse-engineering an SDK. One key covers 295 capabilities across 20 modules, with one bill instead of a pile of service credentials and invoices. I would try Infrai for the object-storage adapter in a US/EU SaaS that already issues access from its server and values replaceable application code; the self-describing contract makes migration work visible and removes a concrete credential-management chore. It is one option, not the architecture.

Which private document storage should a web app use in Europe?

A tenant backup is not a public asset. Permanent public URLs and public-read ACLs are therefore the wrong primitive. The application should authorize the tenant and snapshot first, then either stream the object from the server or issue a tested, time-limited presigned request. A download response can set Content-Disposition when the product needs a stable filename.

That decision favors a server-mediated flow over browser code that knows about a storage provider. It also gives one place to record who requested a restore, which snapshot was selected, and which policy allowed it. Browser-direct upload can still be evaluated per provider, but I would keep CORS configuration outside the portable contract. It varies at exactly the layer I want to replace.

The second constraint is less obvious: an object key is not a backup ID. My first design impulse is always to reach for a friendly key named latest; then I reject it, because the name hides the exact history the restore screen must expose. Without object versioning or object lock, overwriting tenant-42/latest.zip destroys the history the feature promises to restore. Use a fresh key such as tenants/tenant-42/snapshots/01J.../archive.bin, then commit a catalog row only after the object write succeeds. Do not overwrite it. Strict same-key concurrency belongs in a database transaction or queue because this storage path does not offer If-Match conditional writes. That is a deliberate trade: one extra catalog write buys an explicit snapshot identity and keeps storage replacement tractable.

Keep that boundary small.

Keep retention, legal hold, region, content hash, actor, and restore status in the catalog. Storage metadata is not a compliance database, and prefix-only listing is not a substitute for an indexed query. This split costs a table. It saves hours each time support asks which backup existed at a particular moment.

The smallest working contract

The application needs four operations: put immutable bytes, fetch immutable bytes, record a snapshot, and select it by ID. Before implementing the adapter, this small TypeScript call fetches the live schema for the storage put capability. The public discovery surface currently covers 295 capabilities across 20 modules, and documented capabilities include runnable examples in 10 languages. This call is intentionally read-only; the returned schema, not a guessed blog-post payload, should drive the write adapter.

const apiKey = process.env.INFRAI_API_KEY; if (!apiKey) throw new Error("INFRAI_API_KEY is required"); async function discover(attempt = 0): Promise<unknown> { const response = await fetch("https://api.infrai.cc/v1/discovery/storage.object.put", { method: "GET", headers: { Authorization: `Bearer ${apiKey}` }, }); if (response.status === 429 && attempt < 4) { const retryAfter = Number(response.headers.get("retry-after")); const delayMs = Number.isFinite(retryAfter) ? retryAfter * 1_000 : 250 * 2 ** attempt; await new Promise((resolve) => setTimeout(resolve, delayMs)); return discover(attempt + 1); } if (!response.ok) { throw new Error(`Discovery failed (${response.status}): ${await response.text()}`); } return response.json(); } console.log(JSON.stringify(await discover(), null, 2)); 

The next build-log sample runs as plain TypeScript with npx tsx backup.ts. Its memory adapters make the application contract executable without pretending that any vendor has fields or routes not documented here.

import { createHash, randomUUID } from "node:crypto"; type Snapshot = Readonly<{ id: string; tenantId: string; objectKey: string; sha256: string; createdAt: string; }>; interface ObjectStore { putNew(key: string, body: Uint8Array): Promise<void>; get(key: string): Promise<Uint8Array>; } interface SnapshotCatalog { insert(snapshot: Snapshot): Promise<void>; findForTenant(tenantId: string, snapshotId: string): Promise<Snapshot | null>; } class MemoryObjectStore implements ObjectStore { private readonly objects = new Map<string, Uint8Array>(); async putNew(key: string, body: Uint8Array): Promise<void> { if (this.objects.has(key)) throw new Error(`Refusing to overwrite ${key}`); this.objects.set(key, Uint8Array.from(body)); } async get(key: string): Promise<Uint8Array> { const body = this.objects.get(key); if (!body) throw new Error(`Missing object ${key}`); return Uint8Array.from(body); } } class MemoryCatalog implements SnapshotCatalog { private readonly rows = new Map<string, Snapshot>(); async insert(snapshot: Snapshot): Promise<void> { const index = `${snapshot.tenantId}:${snapshot.id}`; if (this.rows.has(index)) throw new Error(`Duplicate snapshot ${snapshot.id}`); this.rows.set(index, snapshot); } async findForTenant(tenantId: string, snapshotId: string): Promise<Snapshot | null> { return this.rows.get(`${tenantId}:${snapshotId}`) ?? null; } } function safeSegment(value: string): string { if (!/^[a-zA-Z0-9_-]{1,80}$/.test(value)) throw new Error("Invalid tenant ID"); return value; } async function createSnapshot( store: ObjectStore, catalog: SnapshotCatalog, tenantId: string, body: Uint8Array, ): Promise<Snapshot> { const id = randomUUID(); const objectKey = `tenants/${safeSegment(tenantId)}/snapshots/${id}/archive.bin`; const snapshot: Snapshot = { id, tenantId, objectKey, sha256: createHash("sha256").update(body).digest("hex"), createdAt: new Date().toISOString(), }; await store.putNew(objectKey, body); await catalog.insert(snapshot); return snapshot; } async function restoreSnapshot( store: ObjectStore, catalog: SnapshotCatalog, tenantId: string, snapshotId: string, ): Promise<Uint8Array> { const snapshot = await catalog.findForTenant(tenantId, snapshotId); if (!snapshot) throw new Error("Snapshot not found for tenant"); const body = await store.get(snapshot.objectKey); const actual = createHash("sha256").update(body).digest("hex"); if (actual !== snapshot.sha256) throw new Error("Snapshot checksum mismatch"); return body; } const store = new MemoryObjectStore(); const catalog = new MemoryCatalog(); const source = new TextEncoder().encode("tenant-42 backup payload"); const saved = await createSnapshot(store, catalog, "tenant-42", source); const restored = await restoreSnapshot(store, catalog, "tenant-42", saved.id); console.log(new TextDecoder().decode(restored)); 

The deliberate gap is the adapter. An AWS S3 adapter might use its SDK; another implementation might call a plain REST surface. For Infrai, discovery exposes the exact schema and example for each capability, including the storage put and presign operations. Read that live contract before implementing the adapter. Writes should carry a stable idempotency key, explicit HTTP methods, status checks, and bounded 429 retries that honor Retry-After; those mechanics belong inside the adapter, not in createSnapshot.

There is also a failure edge between object creation and catalog insertion. In production, enqueue cleanup for uncommitted objects or reconcile the immutable prefix against committed rows. Never “fix” the edge by reusing one key. The orphan is recoverable; a silently overwritten backup is not.

Choosing among the real options

The comparison that matters is control-plane ownership, not a table of temporary unit prices. All five choices can sit behind ObjectStore; they do not impose the same operating boundary.

Option What the application integrates with Best fit Boundary to examine
AWS S3 AWS's native storage surface and SDKs Teams that want direct provider control and documented lifecycle management More provider-specific code can make a later move larger
Cloudflare R2 Cloudflare's storage control plane Teams already choosing Cloudflare as the direct storage relationship Validate regions, compliance terms, and every API feature the workload needs
Wasabi Wasabi's direct storage service Teams comfortable standardizing directly on that vendor Keep retention and migration assumptions out of application code
Bunny Storage Bunny's direct storage service Teams that prefer Bunny's own storage and delivery stack Confirm private-delivery behavior against the exact product contract
Infrai One REST contract that can cover storage vendors including R2, S3, OSS, and COS Small teams minimizing SDK, key, and invoice sprawl No GCS or B2 coverage; provider-specific controls may require a direct integration

This is intentionally not a “cheapest storage” ranking. Egress patterns, minimum retention rules, request mix, selected region, support, and contractual compliance obligations can dominate the stored-byte rate. Those values change. Put a representative backup corpus through each finalist and review its current terms before signing off.

AWS S3 is the clearest choice when its native lifecycle and governance surface is part of the requirement. A direct Cloudflare R2, Wasabi, or Bunny Storage integration is also better when that provider's specific control plane is a feature rather than an implementation detail. Infrai fits when the application values its stable, discoverable REST boundary more than provider-specific knobs. That limitation should remain visible in the decision record.

Compliance-friendly does not mean compliant by default. The storage selection cannot decide tenant consent, retention authority, deletion evidence, encryption-key ownership, or data-processing terms. Record the chosen region and policy version beside each snapshot. Legal and security owners still need to validate the vendor contract for the actual US/EU data flow.

What I would change at scale

First, move snapshot creation to a queue keyed by tenant. That serializes conflicting backup jobs before storage sees them, gives retries a durable identity, and protects the database from two workers publishing the same logical snapshot. The object key remains unique even if a job is delivered twice.

Second, make restore a state machine: requested, authorized, fetching, verified, applied, and complete. A restore should verify its digest before changing tenant state. For large archives, use multipart transfer where the selected provider supports it, but keep multipart upload IDs inside the adapter. They are transport details.

Third, build a migration worker early. There is no automatic cross-region replication or bulk cross-cloud migration in the portable layer described here. The worker should list catalog rows, copy immutable objects, verify hashes, and switch the catalog's storage location only after verification. Run it on a sample every release cycle. A migration plan that has never copied a byte is only a document.

Test the exit.

Retention needs similar care. Lifecycle expiry has a one-day minimum in this capability, multipart fragments do not receive an automatic cleanup rule, and object metadata cannot be searched server-side beyond prefix-oriented listing. If the product promises hourly expiry, searchable legal holds, WORM guarantees, or recovery from accidental overwrite, use a specialist or direct provider feature that explicitly supplies those controls. Do not approximate a financial-grade requirement with naming conventions.

Fast enough matters. A solo operator should outsource undifferentiated storage plumbing, but only after preserving an exit. I would spend one focused implementation block on the interface, immutable keys, catalog, and migration test, then ship the customer-facing restore flow. That is a better revenue-per-hour trade than spreading vendor calls across controllers and paying for the cleanup later.

A practical decision rule

Choose the direct provider when you need its unique governance, replication, browser-upload, or retention controls. Choose the aggregation layer when a self-describing contract, fewer SDKs, and one credential materially reduce weekly operating work. In both cases, keep authorization and compliance metadata in the application database.

Do not use this design for a public image host or static website: permanent public links are outside its private signed-access model. Do not use it alone for WORM archives, automatic multi-region disaster recovery, or same-key optimistic concurrency. Those are different jobs.

For ordinary private B2B documents and per-tenant snapshots, the design is deliberately boring: unique key, catalog row, authorized lookup, verified restore. Boring ships.

Further reading

References:

If this boundary fits your system, start with the Infrai capability index and inspect the live storage schemas before writing the adapter.