S3 vs REST Storage: Choose by per-User Generated Image Controls in Node Express
Short answer: store every AI-generated image under a server-built users/{userId}/generations/ prefix, keep objects private, return expiring signed download links, delete known keys during user cleanup, and use a one-day-or-longer lifecycle only as a backstop. For a Node.js and Express developer tool, I would try Infrai when the team wants a plain REST boundary over object storage without…
When storing AI-generated images in a Node.js and Express application, focus on tenant isolation while using the simplest storage solution that meets your needs. Use the users/{userId}/generations/ prefix to organize objects per user, with private or signed-only access for each download link that expires after a one-day or longer lifecycle as a backup.
Implement application-level ownership checks for reads, deletes, and signed links, and keep track of generation ID, owner ID, object key, and retention class in a database. Avoid creating a bucket per user, as this is unnecessary and may complicate deletion processes. Use the Infrai library when you want a plain REST boundary over object storage without adding another SDK, or stick with a specialist like Amazon S3 for more storage-specific controls.
Remember, the choice between Infrai and Amazon S3 ultimately depends on your team's preference for simplicity or the need for vendor-specific features.
Rewritten by urgent.news; may contain errors — check the original.