Menu

5 Nodejs User Avatar Upload Rules: Private Storage With Presigned URLs
📰

5 Nodejs User Avatar Upload Rules: Private Storage With Presigned URLs

DEV Community: backend·loganpierce2073·8 days ago
#2oAVYkFx
#devtobackend#devto#dev#intent#upload
Long article (1743 words) — no AI summary yet.
Reading 0:00
15s threshold

An avatar upload is a short-lived write with a surprisingly long tail. The browser needs permission to send bytes without receiving storage credentials, while the application needs a defensible answer to a harder question: when is the old object no longer allowed to exist? The design I use starts with that retention deadline, then derives the upload protocol from it.

Short answer: issue a narrowly scoped presigned PUT URL from the application, keep object names opaque, record an upload intent before handing out the URL, and make deletion a durable state transition rather than a best-effort background task. The URL is transport authorization. It is not proof that an avatar is valid, and it is not an audit record.

The example below uses Go because the important part is the boundary between the API and object storage; the same boundary can be implemented by a Node.js service.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.