A customer-support SaaS has one constraint that changes this storage decision: a signed document may need an explicit deletion deadline, while an OpenAI or Stable Diffusion image may be regenerated but still has to survive a deploy.
Short answer: store the image or signed-document bytes in private object storage, keep metadata plus delete_after in the database, and put both operations behind an application-owned TypeScript interface. Database blobs are reasonable at tiny volume. Local disk is for disposable, single-instance development.
This split gives each system one job. The bucket holds bytes. The database answers business questions. A deletion worker enforces time. Your adapter keeps the vendor choice reversible.
How should a SaaS store OpenAI and Stable Diffusion generated images?
Start with a before-and-after picture. Before: an attachments table contains a multi-megabyte blob, application rows, and retention state. Every backup and database operation carries the binary along.…