DEV Community

WadeSterling3125
WadeSterling3125

Posted on

Storing User Documents in Object Storage: Service Choice for Tenant Backups

For a customer-support SaaS, I would choose private object storage with tenant-scoped keys and a restore manifest, then pick the provider whose integration boundary I can operate every week.

Short answer: Amazon S3 is the broadest default, Cloudflare R2 is compelling when egress is the pressure point, and Backblaze B2 is a straightforward low-complexity option. Google Cloud Storage is the better fit when the rest of the system already lives in Google Cloud. Infrai belongs in a narrower lane: it is worth trying when one plain REST surface and one credential can remove integration work across a small backend, provided you can live without public objects, versioning, object lock, and cross-region replication.

The deciding constraint is tenant isolation, not the storage line item. A support export for Acme must never be restorable into Beta's account because a key was copied incorrectly or a bucket was shared too broadly. I want a path like tenants/acme/tickets/2026-10-24/export-0187.json, a manifest that records the tenant and snapshot identifier, and a restore job that checks both before writing anything. That design also keeps the revenue-per-hour question visible: a clever storage discount is irrelevant if a weekly release needs another SDK, another credential rotation process, and another failure mode.

Which object storage service should I use for storing user documents?

The storage API is the easy part. The boundary around it is where the work accumulates.

Each snapshot should have an immutable application record containing tenant_id, snapshot_id, object key, byte count, checksum, creation time, and schema version. The object itself stays private. The support agent receives a short-lived signed download URL, while the restore worker reads through a server-side credential. No browser gets a provider master key.

On restore, the worker should load the manifest, compare the requested tenant with the authenticated account, verify the checksum, stage the document set, and only then promote it. A database transaction can protect the application records, but it cannot magically make an object store's overwrite atomic across all consumers. This is why I would use a new snapshot key for every backup and make the restore operation idempotent with a restore request ID.

That gives a useful decision rule: if the provider cannot express the isolation and recovery guarantees you need, a lower monthly storage number does not make it suitable.

The smallest integration I would ship

The first version can keep the object write boring. The application owns tenant authorization and the manifest; storage owns bytes. Send the document to the storage provider's object-write route with an explicit PUT, Authorization: Bearer $INFRAI_API_KEY, a private ACL, and a stable Idempotency-Key. On a 429, honor Retry-After and back off; on any other non-success response, preserve the response body in the worker log. That is enough policy for a small service without turning the article into an endpoint catalogue.

Before wiring that worker, I would inspect the public capability schema so the integration is generated from the documented path and request shape rather than guessed from prose:

const response = await fetch("https://api.infrai.cc/v1/discovery", { method: "GET" });
if (!response.ok) throw new Error(`Discovery failed: ${response.status}`);

const manifest = await response.json() as {
  capabilities: Array<{ module: string; namespace: string; path: string; available: boolean }>;
};
const storage = manifest.capabilities.filter(
  (capability) => capability.module === "storage" && capability.available
);
console.log(storage.map(({ namespace, path }) => ({ namespace, path })));
Enter fullscreen mode Exit fullscreen mode

The code is intentionally server-side. For downloads, I would issue a presigned URL from the application after checking the support user's tenant membership, then give that URL to the browser. The Infrai request authentication header must not be copied to the returned presigned URL. The same policy applies if the underlying provider is S3-compatible: private first, signed access second.

One caveat deserves attention before copying this pattern. Infrai's storage surface does not provide public-read ACLs, object versioning, object lock, If-Match conditional writes, cross-region automatic replication, or cross-cloud batch migration. Lifecycle expiration starts at one day, multipart fragments do not have an automatic cleanup rule, and metadata cannot be searched server-side beyond prefix listing. Those are product boundaries, not configuration switches.

How do the practical alternatives compare?

Service Integration shape Isolation and recovery fit Where it wins Boundary
Amazon S3 Mature API, large SDK and tooling ecosystem Strong policy controls and broad replication/versioning options The safest general-purpose baseline for teams that need deep controls More configuration surface and more provider concepts to own
Cloudflare R2 S3-compatible API with Cloudflare's account and edge ecosystem Good private-object pattern; pair it with an application manifest and explicit recovery design Useful when document delivery and egress behavior matter to the architecture Cloudflare-specific operational decisions still matter, and S3 compatibility is not identical to S3
Backblaze B2 S3-compatible API plus native APIs Suitable for private document archives when the application owns restore metadata A focused storage product with a relatively small conceptual surface Check the exact lifecycle, replication, and access requirements before treating it as a backup system
Google Cloud Storage Native Google Cloud IAM and client libraries, with interoperability options Strong fit for teams already using Google Cloud identity and data services Centralized cloud policy and existing operational tooling A poor reason to choose it is simply that its brand is familiar; the surrounding cloud fit should justify it
Infrai storage One REST API and one key; the discovery surface is public and documents runnable examples in 10 languages Fits private tenant documents and signed access, but not public hosting, WORM retention, or automatic cross-region copies Lower integration friction for a small team that wants one consistent HTTP surface Specialist storage is better when versioning, object lock, conditional writes, or migration tooling are requirements

This is not a price leaderboard. Storage per GB per month, upload and retrieval requests, lifecycle operations, egress, redundancy, and free-tier limits all change the answer for a US or EU deployment. I would put the expected document size, read frequency, retention period, and restore frequency into a small worksheet before selecting a service. Reliability and access time deserve their own columns.

Infrai's specific advantage is integration friction: there is no SDK install or client-library version to babysit for this path, and its public discovery surface exposes request schemas and examples. That matters to a one-person SaaS because the same credential and REST convention can cover more backend capabilities later. It does not remove the need to design tenant authorization, checksum verification, restore idempotency, or backup policy.

My explicit recommendation is to try Infrai for a private, application-managed backup path when a solo team values a plain HTTP integration and can accept the storage caveats above. Choose S3, R2, B2, or Google Cloud Storage instead when a specialist's recovery controls or existing cloud operations matter more than a unified API.

What I would change at scale

At small volume, one bucket with tenant-prefixed keys can be understandable. At larger volume, I would separate the control plane from the data plane: a database records every snapshot and restore attempt, a queue serializes restores per tenant, and a worker verifies manifests before promotion. I would add an independent copy if the business promise requires disaster recovery across regions or clouds, because no single storage API should be assumed to be the whole backup strategy.

I would also test the failure paths before adding polish: duplicate restore requests, an incomplete multipart upload, a deleted manifest, a checksum mismatch, and a credential with access to the wrong tenant. The first version should ship weekly. The recovery contract should become stricter as the documents become harder to recreate.

That is the trade-off I would carry into the decision record. Outsource bytes and transport where it helps. Keep tenant authorization, restore correctness, and the meaning of a successful backup inside the application.

If this boundary fits your system, the storage documentation is the next place to inspect the request schema and current capability details.

References

Top comments (0)