AIUpdated 2026-11-20

Object storage

Keeping files outside the database: metadata in rows, bytes in storage, and temporary access through signed links.

The warehouse for big items like photos and documents, kept apart from the ledger.

That is object storage. The ledger holds the facts, such as who owns the photo and when it arrived. The warehouse holds the heavy item itself.

How it works

Object storage is a service built for large binary files: images, video, PDFs and documents. It is separate from the relational or document database.

Code
Client → API → Object storage     (the bytes)
              → Database           (the metadata)

The database keeps a small row of metadata, such as an id, an owner, a file reference and a created time. The storage holds the file.

Files do not belong inside the relational database unless there is a specific reason. At scale, object storage is simpler and far cheaper per gigabyte, and it keeps the database small enough to back up and restore quickly.

Access without making files public

Most files should not have a permanent public address. Two common ways to grant access:

  • Signed URLs. The server creates a link that works for a limited time, for a specific object. The browser then fetches directly from storage.
  • Proxying through the API. The server checks permission and streams the file. This gives full control and costs bandwidth on your own servers.

A signed link is a temporary grant instead of a permanent address. Keep the expiry short, and check the user's permission before creating the link.

Uploads

For large uploads, the server can hand the client a signed upload link, and the client sends the file straight to storage. The API never carries the bytes, which keeps request handlers small and fast. After the upload, the app records the metadata row.

What goes there

  • user-uploaded media and documents
  • static assets and exports
  • backups
  • anything that will later be served through a CDN

Small structured data belongs in the database, not in storage.

Lifecycle and cleanup

Files accumulate. Decide early what happens to a file when its row is deleted, when a user replaces an upload, or when an upload starts and never finishes. Lifecycle rules can expire temporary files and move old ones to cheaper storage. A periodic job that compares rows against stored objects finds orphans in both directions. Without a plan, storage cost grows quietly and deleted documents may linger, which matters when the files are personal records.

Where I used it

In PeopleCore HR, documents are served by signed URL, not as open files. The link is a temporary grant. I do not claim more than that about the storage setup.

Trade-offs

  • Metadata and bytes can drift. A row can point at a missing file, or a file can have no row. Decide which is the source of truth and clean up orphans.
  • Signed links leak if shared. Anyone holding the link can use it until it expires. Short expiries limit the damage.
  • Eventual consistency in some services. Check the provider's guarantees before assuming a file is readable the instant it is written.
  • Not a database. Querying across files is slow or impossible. Keep what you search by in the database.
  • Egress costs. Reading data out can cost more than storing it. A CDN can reduce repeated reads.

A useful rule: bytes in storage, facts in the database, and a short-lived link between the user and the file.