System Architecture

Document: 12-system-architecture.md
Version: 1.0.0


Purpose

This document defines the high-level system architecture used across all Rundown web projects.

Its purpose is to provide a clear overview of how the different parts of an application interact. While individual subsystems are documented separately, this document serves as the architectural blueprint that connects them.

Unless project-specific requirements dictate otherwise, every Rundown project should follow this architecture.


Architecture Overview

A standard Rundown application consists of the following layers:

                     User
                       │
                       ▼
              Cloudflare DNS & CDN
                       │
                       ▼
                 Nginx Reverse Proxy
                       │
                       ▼
              Next.js Application
                       │
        ┌──────────────┼──────────────┐
        ▼              ▼              ▼
  Payload CMS     PostgreSQL     Cloudflare R2
        │
        ▼
 External Services
(Payments, Email, Analytics, APIs)

Each layer has a clearly defined responsibility and should remain as independent as possible.


Architectural Principles

Every Rundown application should follow these principles:


Core Components

Frontend

Responsible for:

Standard:


Content Management

Responsible for:

Standard:


Database

Responsible for:

Standard:

The database stores application data only.

Large media files should not be stored directly in the database.


Object Storage

Responsible for:

Standard:

Only file references should be stored inside PostgreSQL.


Hosting

Responsible for:

Standard:


CDN

Responsible for:

Standard:


Request Flow

A typical request follows this path:

Browser
    │
    ▼
Cloudflare
    │
    ▼
Nginx
    │
    ▼
Next.js
    │
    ├── Payload CMS
    ├── PostgreSQL
    └── Cloudflare R2

The frontend coordinates communication between supporting services while presenting a unified experience to the user.


Data Flow

Application data should flow in a predictable manner.

Client

↓

Next.js

↓

Payload CMS

↓

PostgreSQL

↓

Response

Media follows a different path.

Client

↓

Cloudflare R2

↓

URL stored in PostgreSQL

↓

Frontend renders asset

Separating structured data from media storage improves scalability and reduces database size.


External Services

Applications may integrate with external services such as:

External services should remain isolated behind reusable service modules.

Direct integration logic should not be scattered throughout the application.


Security Principles

Every Rundown application should:

Security is considered a responsibility of every subsystem.


Scalability

Applications should be designed so that additional features can be introduced without significant architectural changes.

Examples include:

Scalability should come from modular design rather than unnecessary abstraction.


Engineering Decision

Standard Architecture

Status: Accepted

Decision

Rundown adopts a modular architecture centered around a single Next.js application with integrated Payload CMS, PostgreSQL, and Cloudflare R2.

Reasoning

This architecture provides:

It supports the majority of websites developed by Rundown without introducing unnecessary infrastructure complexity.


Architecture Checklist

Before beginning development, verify:


Summary

The system architecture defines the overall structure of every Rundown application.

By standardizing how each subsystem interacts, Rundown ensures that projects remain consistent, maintainable, scalable, and cost-effective while allowing individual components to evolve independently.