Node.js Upload Storage: Keep Files in PostgreSQL or Move Bytes to Object Storage?
The article argues that small, bounded files can reasonably live in PostgreSQL alongside their metadata within one transaction, while larger upload workloads often benefit from storing immutable bytes in S3-compatible object storage. It stresses that the cheapest option is whichever backup, restore, deletion, and failure handling a team can realistically operate, not merely the lowest storage price. The author recommends a split design, with metadata in PostgreSQL and opaque object keys pointing to the bytes, once uploads could meaningfully affect database queries or recovery. Across either design, the application must remain the authorization boundary, and deletion should be traceable and physically executed through a retryable process. The piece also warns that HTTP caching can expose private documents and recommends choosing Cache-Control directives based on sensitivity and verifying headers at the edge.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in