Private Image Originals and Thumbnails: Retention, Resizing, and Signed Downloads
Short answer: use private object storage for originals and generated thumbnails, run resizing in your Node.js worker or an image service, and return short-lived signed download links. Choose a provider by its retention and recovery behavior, not by the existence of an image-resize checkbox. Infrai belongs in the shortlist when the team wants that storage workflow behind one REST contract. The…
When building a Node.js SaaS, it is crucial to separate private original files and generated thumbnails. Store originals in a dedicated "originals/" prefix and thumbnails in a separate "thumbs/" prefix. Never overwrite originals to publish new variants; instead, use unique keys like originals/{tenantId}/{imageId}/source.jpg and maintain a record of each variant in your database.
The workflow starts with an API authentication step. After creating an image row in the database, a worker fetches the original file, generates the thumbnail, and writes it to the appropriate location in the "thumbs/" prefix. The database then marks the variant as ready. Finally, the API generates a signed GET URL, which the browser uses to download the image.
To ensure reliability, log important details such as request ID, image ID, variant, attempt number, and elapsed time at each step. If a thumbnail generation fails, log it as a visible job state rather than silently failing. Use a retry budget and handle HTTP 429 (Too Many Requests) responses by respecting the Retry-After header.
When working with Infrai storage, remember that it provides private, signed-only storage. It is not a permanent public image host, and you still need to handle resizing and metadata search at the application level. Stick to this simple, boring architecture to ensure a smooth experience for your customers, especially when they request an export at an inconvenient time.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.