Architecture Boundaries

Document: 13-architecture-boundaries.md
Version: 1.0.0


Purpose

This document defines the responsibilities and boundaries of each major subsystem within a Rundown application.

Clear architectural boundaries ensure that every technology in the stack has a well-defined purpose. By assigning responsibilities to specific layers, Rundown applications remain modular, maintainable, scalable, and easier to reason about.

When a new feature is introduced, developers should first determine which subsystem owns that responsibility before implementing it.


Architectural Philosophy

Every subsystem should have a clearly defined responsibility.

A subsystem should not perform work that properly belongs to another subsystem.

Following this principle:


Frontend (Next.js)

Responsibilities

The frontend is responsible for presenting the application to the user.

It owns:


Non-Responsibilities

The frontend should not own:

The frontend consumes data; it should not become the source of truth.


Payload CMS

Responsibilities

Payload CMS manages structured content and administrative functionality.

It owns:

Payload acts as the content source of truth.


Non-Responsibilities

Payload should not:


PostgreSQL

Responsibilities

PostgreSQL stores structured application data.

Examples:


Non-Responsibilities

PostgreSQL should not store:

Only metadata and references should be stored where appropriate.


Cloudflare R2

Responsibilities

Cloudflare R2 stores binary assets.

Examples:


Non-Responsibilities

R2 should not store:

Object storage exists only for files.


Cloudflare

Responsibilities

Cloudflare provides edge services.

It owns:


Non-Responsibilities

Cloudflare should not:


Docker

Responsibilities

Docker standardizes application execution.

It owns:


Non-Responsibilities

Docker should not:

Containers should remain disposable.


External Services

Examples include:


Responsibilities

External services provide specialized functionality outside the core application.

The application should communicate with them through isolated service layers.


Non-Responsibilities

External services should never become the primary source of business logic unless intentionally designed to do so.

Business rules should remain within the application whenever practical.


Business Logic

Business logic defines how the application behaves.

Examples include:

Business logic should remain within the application layer and should not be duplicated across the frontend, CMS, or external services.


Source of Truth

Every category of data should have a single source of truth.

Data Owner
Content Payload CMS
Structured Data PostgreSQL
Media Files Cloudflare R2
Presentation Next.js
Infrastructure Docker & Coolify
DNS & CDN Cloudflare

Duplicating ownership creates inconsistency and increases maintenance complexity.


Decision Framework

When implementing a new feature, ask the following questions:

  1. What responsibility does this feature represent?

  2. Which subsystem owns that responsibility?

  3. Does this implementation duplicate an existing responsibility?

  4. Can this be implemented without violating an architectural boundary?

If ownership is unclear, the architecture should be reviewed before implementation.


Engineering Decision

Separation of Responsibilities

Status: Accepted

Decision

Every major subsystem within a Rundown application has clearly defined responsibilities and non-responsibilities.

Reasoning

Clearly defined ownership:


Boundary Checklist

Before implementing a feature, verify:


Summary

A well-defined architecture depends on clear ownership.

By assigning responsibilities to specific subsystems and avoiding overlapping concerns, Rundown applications remain easier to understand, extend, and maintain throughout their lifecycle.