Short answer: upload each generated image buffer from the backend to private object storage under a unique, immutable key, then store only that key and auditable generation metadata in the database; restore a snapshot by changing a database pointer, never by overwriting image bytes.
For a multi-tenant healthtech service, retention and deletion change what might otherwise look like a routine Node.js buffer upload. A generated image can become part of a case record, so the system must distinguish an active reference from retained bytes, prove which tenant owned the object at each transition, and make deletion deliberate. Browser upload is the wrong boundary because it exposes credentials and adds CORS policy to a path that the backend already controls.
The architecture decision is therefore a private, backend-to-storage write with immutable keys and a database manifest.…