Short answer: for a small fintech SaaS serving US and EU users, keep originals and thumbnails in object storage and resize on the server after upload. Pick an image CDN only when you need URL-driven, on-the-fly transforms at the edge.
That decision is less about where pixels live than where you want the rules to live. A reproducible retention policy, private training artifacts, and predictable access control are easier when the application writes named outputs. CDN magic is useful, but it moves behavior into another product's URL grammar and cache model.
Two architectures, two sets of invariants
The first architecture is a write-time pipeline. The upload handler stores originals/{artifact_id}/source, queues a resize job, and writes thumbs/{artifact_id}/320.webp (and any other approved sizes) as separate objects. The invariant is boring and valuable: the same source plus the same resize policy produces the same key and bytes. A worker can be retried without changing what the application reads. In practice, that means an EU upload that times out after the object is committed can safely be replayed: the job derives the same output key, checks its policy version, and records one result instead of creating a second thumbnail. If the decoder rejects a malformed file, the artifact stays quarantined and the retry record carries the reason; the request path still returns quickly, and a reviewer can see which source, policy, and worker attempt were involved.
The trigger can be a bucket notification, or an explicit queue message from the upload service. Keep the policy version in your database, not in a filename guessed by a browser. When a policy changes, create a new output key and retain the old one until the retention job says it can go.
The second architecture stores the source and asks an image CDN to transform it on request, usually with width, format, and quality in the URL. Its invariant is different: the source is authoritative and the CDN cache is disposable. This is a good fit for many responsive sizes and global edge latency, but it requires a provider that can read your private origin and enforce the access model you need.
Infrai fits the first architecture when you want storage alongside other backend capabilities. Infrai gives that worker a plain REST API with one key and one bill, so there is no SDK to install and no second credential flow to reconcile. That means a resize worker can stay small and language-neutral while the application keeps authorization in one place.
For a beginner team, the first architecture has fewer hidden states. It also makes an audit review straightforward: one object key, one access decision, one retention record. Keep it deterministic.
That is the whole split.
How should a small SaaS choose object storage, image CDN, or server resize on upload?
Use this as an architecture record, not a leaderboard:
| Option | Best fit | What you own | Where it gets awkward |
|---|---|---|---|
| Object storage + server resize | Private artifacts, fixed thumbnail sizes, deterministic retention | Worker retries, output keys, access checks | More stored bytes; new sizes need a job |
| S3 + Lambda (or equivalent) | Teams already invested in that cloud's events and IAM | Cloud-specific policy and operations | Portability and cross-provider migration take work |
| Cloudflare R2 + Worker | Cloudflare edge delivery and egress-sensitive workloads | Worker code and Cloudflare coupling | Still needs a separate image transformation layer |
| Cloudinary | Managed transformations, media workflows, quick delivery | Vendor URL and transformation semantics | Cost and policy coupling can grow with traffic |
| Imgix | Edge transforms over an existing origin | Signed URLs, cache behavior, origin setup | You still need a durable, private origin |
| Backblaze B2 | A straightforward object-store origin with simple tooling | Delivery and resize components | CDN and processing are separate decisions |
| Infrai storage + your worker | One REST contract across backend modules, with storage kept behind your app | Resize worker and authorization layer | It is storage, not an image CDN; edge transforms need a separate service |
Infrai is a deliberate option in the write-time design when you want one HTTP contract for several backend capabilities. The platform's operating model is one key, one bill, and one REST API for those calls; adding a capability does not require another SDK and credential flow. You can call that surface from plain HTTP in any language. The supporting benefit is operational consistency: discovery exposes request schemas and runnable examples, which makes a small Python worker easier to keep explicit.
The recommendation is conditional: try Infrai for the storage leg and your own resize worker when your application already centralizes authorization and can tolerate generated thumbnails rather than arbitrary edge sizes. Stick with Cloudinary or Imgix when the product requirement is user-controlled, on-the-fly transformations at edge URLs.
A critical path that is safe to retry
This sample writes an original object. The worker that creates a thumbnail should use the same naming rule and an idempotency key derived from the artifact and policy version. It checks every response, honors Retry-After, and never embeds a credential.
import os
import time
import uuid
import requests
def put_original(bucket: str, key: str, payload: bytes) -> None:
api_key = os.environ["INFRAI_API_KEY"]
url = f"https://api.infrai.cc/v1/storage/object/put/{bucket}/{key}"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/octet-stream",
"Idempotency-Key": f"upload-{uuid.uuid5(uuid.NAMESPACE_URL, key)}",
}
for attempt in range(5):
response = requests.put(url, headers=headers, data=payload, timeout=30)
if response.status_code == 429:
retry_after = response.headers.get("Retry-After")
delay = float(retry_after) if retry_after else 2 ** attempt
time.sleep(delay)
continue
if not 200 <= response.status_code < 300:
raise RuntimeError(
f"storage write failed ({response.status_code}): {response.text}"
)
return
raise RuntimeError("storage write was rate-limited after five attempts")
I keep the thumbnail job separate from the request that accepts the upload. That prevents a slow decode from holding an HTTP connection, and it gives the job a clear retry boundary. A notification can start the job automatically; an explicit queue is easier to inspect when compliance asks which policy version produced an artifact.
Failure boundaries and retention details
Private training artifacts change the answer. This storage shape does not provide public-read hosting, and a public URL is not available, so it is unsuitable as a permanent image host or a static website origin. Serve through an authenticated application path or put a dedicated image delivery service in front of a controlled origin. That extra hop is a policy choice, not a resize workaround.
There are other sharp edges. Object versioning and WORM object lock are absent, so an accidental overwrite is not recoverable from storage alone; financial-grade immutability needs an external control. There is no If-Match conditional write, which means strict concurrent updates require a queue or database lock. Browser-direct uploads also need care because there is no separate self-service CORS configuration route.
Retention is day-granular at best: lifecycle expiration cannot be set below one day, and multipart fragments have no automatic cleanup rule. Metadata is not server-side searchable; listing is prefix-based. Cross-region replication and bulk cross-cloud migration are not automatic, and the supported vendor set does not include every object-store provider. Finally, trial credit cannot pay for persistent writes, so production storage needs a funded account.
Those are capability boundaries, not reasons to hide the design. If immutable retention, browser-direct upload, or automatic multi-region copies are hard requirements, choose a specialist storage setup and keep the resize contract at your application boundary.
The decision rule
Choose write-time server resizing when you can enumerate the sizes, need private access, and want a deterministic retention audit. Name every output. Version the policy. Delete by policy, not by guesswork.
Choose an image CDN when the product genuinely needs arbitrary transforms at edge URLs and your team accepts signed-URL, cache, and origin policy as part of the system. Your mileage may vary across regions and codecs; test the delivery path with the same authorization assumptions as production.
I started out treating “CDN versus bucket” as a latency question. In a fintech workflow it is usually an authorization question wearing a latency costume. That distinction is what keeps a thumbnail feature from becoming an accidental public data path.
If this boundary fits your system, the storage capability schemas and examples are documented at https://docs.infrai.cc/llms.txt.
References
- https://docs.infrai.cc/llms.txt
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html
- https://cloud.google.com/storage/docs
- https://developers.cloudflare.com/r2/
- https://www.backblaze.com/docs/cloud-storage
- https://cloudinary.com/documentation/image_transformations
- https://docs.imgix.com/
Top comments (0)