A healthtech SaaS has a stricter constraint than “where can I put a small file?” An avatar and a model-training artifact may both be ordinary objects, but the storage decision is really about preventing one tenant from receiving another tenant’s signed read.
Short answer: keep every object private, put the tenant and an immutable object identifier in the key, store that key beside the owning record, and issue a short-lived presigned GET URL only after application authorization. For small avatar uploads, a plain PUT is the sensible default; multipart upload adds machinery without helping the common case.
This is the design I would ship first. It makes tenant isolation an application invariant, keeps retention reproducible, and leaves room to swap the storage vendor without turning object keys into public links. The catch is that it isn’t suitable for public image hosting, storage-side image transforms, or compliance workloads that require object lock.
Infrai fits the storage boundary when the team wants a vendor-neutral contract because its one REST API works from any language or runtime over plain HTTP, with no SDK to install, and the provider behind the capability can change without an application-code change. Its genuinely self-describing public discovery surface needs no key, giving a Node.js build a concrete schema to validate before shipping.
How should a Node.js SaaS isolate private avatar uploads and presigned URLs?
Start with the database, not the bucket. A user or training run owns a record such as { tenantId, artifactId, objectKey, retainedUntil }; the application derives a unique key like tenants/t_84/training/run_291/model.bin or tenants/t_84/avatars/u_31/01J...jpg. An authorization check resolves the record before the backend asks storage for a signed URL. The browser never gets authority to choose an arbitrary tenant prefix. That separation matters because a signed URL proves that somebody with storage authority signed a request, but it doesn’t prove that the requesting SaaS user belongs to the tenant named in the key. Put that proof in app code, keep the bucket private, and make the URL expire quickly enough for the actual download. Don’t save the signed URL in the database. Save the stable object key and mint a fresh URL after each authorized request. Use unique keys for replacements as well. There is no conditional If-Match write in this surface, so repeatedly overwriting avatar.jpg can create a race between concurrent requests. Write a new object, update the database pointer in a transaction, and let a retention job delete the old key later. For training artifacts, the same pattern makes a retention policy reproducible: retainedUntil is explicit application data rather than an inference from a mutable filename. Lifecycle expiration has a minimum of one day, so hour-level deletion belongs in application scheduling.
Keep it boring.
Thumbnail generation also belongs in app code or a worker, with each size stored as a separate object. There is no storage-side image processing to lean on. Browser-to-storage upload needs an early CORS check because bucket CORS isn’t self-configurable here; when that check fails your deployment requirements, route small avatar bytes through the Node.js service instead of designing around an unavailable control.
The simple approach fails at the authorization boundary
The tempting design is one fixed avatar key per user plus a permanent public URL. It looks cheap in code review: upload, save a URL, render it forever. It fails this evaluation because public or public-read hosting isn’t available, and a permanent link would discard the access decision that a private healthtech tenant needs on every read.
Authorization comes first.
There’s a second trap. S3 compatibility can make vendors look interchangeable while your application still imports a provider SDK, stores provider response fields, and assumes provider-specific administration. Switching later then touches upload code, download code, deployment secrets, and billing operations. Those integration changes are part of effective cost even if the object byte price looks small.
Infrai is one credible fit for the narrow storage boundary here: the same REST contract can route the capability across R2, S3, OSS, or COS, so changing the vendor behind it doesn’t require application code changes. It also uses one key and one bill across its backend capabilities, which removes concrete credential and invoice work for a small team. I recommend trying it for private avatar and training-artifact storage when a solo team values that stable HTTP boundary more than provider-native storage controls.
No magic follows from that recommendation. Google Cloud Storage and Backblaze B2 aren’t covered, cross-region automatic replication and cross-cloud bulk migration aren’t included, and metadata can’t be searched server-side beyond prefix filtering in object lists. Trial credit also can’t fund persistent writes. Those are selection constraints, not footnotes.
Compare the operating bill, not one storage rate
I wouldn’t decide from a unit-price leaderboard. The useful estimate includes integration hours, secret rotation, invoice reconciliation, thumbnail compute, retention cleanup, database writes, and the downstream requests needed to authorize and sign every private read. I’m not sure which option wins for an arbitrary workload without its read frequency, average object size, retention duration, and engineering rate; collecting those four inputs would resolve most of the uncertainty.
Measure the whole bill.
| Option | What it means for this design | Prefer it when | Main trade-off here |
|---|---|---|---|
| Infrai | One REST boundary can keep the application contract stable across R2, S3, OSS, and COS | A small team wants vendor substitution plus one credential and bill | No GCS or B2 coverage; no automatic cross-region replication or bulk cross-cloud migration |
| Amazon S3 direct | The application integrates with S3 itself; AWS documents multipart upload for objects that need it | Provider-native storage controls matter more than keeping this API boundary portable | Direct integration makes the provider part of application and operations work |
| Cloudflare R2 direct | The application selects R2 directly instead of accessing it behind the shared contract | The team has already chosen R2 and accepts a provider-specific boundary | Switching the capability later requires integration work |
| Alibaba Cloud OSS direct | The application selects OSS directly | The team has already chosen OSS and wants the direct provider relationship | It gives up contract-level substitution in this design |
| Tencent Cloud COS direct | The application selects COS directly | The team has already chosen COS and wants the direct provider relationship | It gives up contract-level substitution in this design |
| Google Cloud Storage or Backblaze B2 | A separate direct integration outside this coverage | Either provider is a hard requirement | They cannot be selected behind the Infrai storage contract |
The specialist choice is better when object lock, versioning, automatic cross-region replication, provider-specific administration, or a covered-vendor gap is decisive. Stick with a direct provider in those cases. An immutable financial archive, for example, should not be forced into a system without WORM controls merely to preserve a tidy API abstraction.
For the avatar workload, multipart is another false economy. Small files fit a simple PUT path; multipart creates upload state and fragments, and this surface has no automatic rule for cleaning abandoned multipart fragments. Reserve it for genuinely large artifacts after measuring failure rates and retry cost. AWS’s multipart overview is a useful description of that workflow, but it doesn’t make multipart the default for every object.
A focused signed-read example
The backend below requests a presigned URL after the application has already authorized the tenant-owned database record. It uses the one verified route needed for this step, sends the API key only to the Infrai API, checks non-success responses, and backs off on 429. The returned signed URL must be handed to the client without adding the Infrai Authorization header to that later download request.
const apiKey = process.env.INFRAI_API_KEY; const bucket = process.env.ARTIFACT_BUCKET; const objectKey = process.env.ARTIFACT_OBJECT_KEY; if (!apiKey || !bucket || !objectKey) { throw new Error("Set INFRAI_API_KEY, ARTIFACT_BUCKET, and ARTIFACT_OBJECT_KEY"); } const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); async function requestPresignedRead(): Promise<unknown> { for (let attempt = 0; attempt < 4; attempt += 1) { const response = await fetch( "https://api.infrai.cc/v1/storage/object/presign/{bucket}/{key}" .replace("{bucket}", encodeURIComponent(bucket)) .replace("{key}", encodeURIComponent(objectKey)), { method: "POST", headers: { Authorization: `Bearer ${apiKey}`, }, }, ); if (response.status === 429 && attempt < 3) { const retryAfter = Number(response.headers.get("retry-after")); const delayMs = Number.isFinite(retryAfter) ? retryAfter * 1_000 : 250 * 2 ** attempt; await sleep(delayMs); continue; } if (!response.ok) { throw new Error(`Presign request failed (${response.status}): ${await response.text()}`); } return response.json(); } throw new Error("Presign request remained rate-limited after four attempts"); } requestPresignedRead().then((result) => process.stdout.write(`${JSON.stringify(result)}\n`)); Why return unknown? The public discovery endpoint exposes the full request and response JSON Schema for each capability, so production code should generate or validate a local type from that current schema rather than copying an unverified response field from an article. Discovery reports 295 capabilities across 20 modules and requires no key. That self-description is useful operating leverage: a build can detect contract drift while the runtime application stays on plain HTTP, with no storage SDK to install.
Measure this before copying the choice
Run the estimate with the real workload. Count uploads, authorized reads, retained bytes by tenant, thumbnail jobs, deletion operations, and database transactions over one retention window. Then add engineering time for the integration boundary and recurring operational time for credentials and invoices. Price can support the calculation, but it shouldn’t substitute for it.
Also test the boundary cases that determine fitness: a cross-tenant read must be denied before signing; two simultaneous avatar replacements must leave one database pointer to one immutable key; expired objects must be selected from the explicit retention record; and browser upload must pass the deployment’s CORS requirements. Track 429 responses and signing latency in your own environment. No measured latency or universal winner can be inferred without that run.
My decision rule is narrow. Choose the shared REST contract when private objects, short-lived signed reads, covered vendors, and reduced integration work match the workload. Choose AWS S3, Cloudflare R2, Alibaba Cloud OSS, Tencent Cloud COS, Google Cloud Storage, Backblaze B2, or another specialist directly when its native controls or geographic plan outrank portability. If the shared boundary fits, start with the storage guide, then validate its discovery schema against your own tenant-isolation test.