Storage Architecture

Document: 17-storage-architecture.md
Version: 1.0.0


Purpose

This document defines the storage architecture used across all Rundown projects.

Storage is responsible for managing binary assets such as images, videos, documents, and client uploads. Separating media storage from structured application data improves scalability, reduces database size, and simplifies infrastructure management.

Rundown standardizes on Cloudflare R2 as the primary object storage solution.


Storage Philosophy

Structured data and binary assets serve different purposes and should be managed separately.

The database stores information about a file.

Object storage stores the file itself.

This separation allows each system to perform the task it is designed for while keeping the overall architecture simple and scalable.


Standard Storage Platform

Rundown standardizes on:

Cloudflare R2

Reasons include:


Responsibilities

The storage layer owns:

Every uploaded file should be stored in object storage rather than on the application server.


Non-Responsibilities

Object storage should not contain:

Only binary assets belong in object storage.


File Ownership

Each uploaded file should have:

This maintains a clear separation between storage and application data.


Supported File Types

Typical assets include:

Images


Videos


Documents

Additional file types may be supported based on project requirements.


Upload Workflow

Standard upload process:

User

↓

Payload CMS

↓

Cloudflare R2

↓

Metadata stored in PostgreSQL

↓

Frontend renders asset

The application should never depend on local filesystem storage for production uploads.


File Naming

Uploaded files should:

Human-readable names may be stored as metadata rather than physical filenames.


Folder Organization

Storage buckets should remain logically organized.

Example:

uploads/

images/

videos/

documents/

downloads/

Project-specific organization may introduce additional directories when justified.


Image Optimization

Images should be optimized before delivery whenever practical.

Objectives:

Preferred formats:

Avoid serving unnecessarily large images to clients.


Access Control

Storage access should follow the principle of least privilege.

Public assets may be exposed through CDN URLs.

Sensitive assets should use signed or authenticated access where appropriate.

Examples include:


CDN Integration

Cloudflare should serve media assets whenever practical.

Benefits include:

Media delivery should not depend on the application server after upload.


Backup Strategy

Object storage should be backed up according to project requirements.

Critical assets should support:

Backups should be tested periodically.


Performance

Storage architecture should prioritize:

Media optimization should occur before or during upload rather than after repeated requests.


Security

Storage should:

Applications should never trust uploaded files without validation.


Engineering Decision

Object Storage Strategy

Status: Accepted

Decision

All production media assets are stored in Cloudflare R2 rather than on the application server or within the database.

Reasoning

Separating media from application data:


Storage Checklist

Before implementing file storage, verify:


Summary

The storage layer is responsible for managing binary assets independently of application data.

By separating file storage from structured data, Rundown applications remain scalable, performant, and easier to maintain while providing reliable media delivery through Cloudflare's global infrastructure.