# 5.3.8 Recordings and Object Storage

## Recording Pipeline

```mermaid
sequenceDiagram
    autonumber
    participant Cam as Camera Browser
    participant Ctrl as Web Controller
    participant Videos as /videos/upload-url
    participant MinIO as MinIO Object Storage
    participant Rec as /recordings/:id/finalize
    participant DB as recordings table
    participant Viewer as Client Browser

    Cam->>Ctrl: stop local MediaRecorder
    Ctrl->>Ctrl: compress recording blob
    Ctrl->>Videos: request presigned upload URL
    Videos-->>Ctrl: objectKey + uploadUrl
    Ctrl->>MinIO: PUT recording blob
    Ctrl->>Rec: finalize recording metadata
    Rec->>DB: mark recording ready
    Viewer->>Rec: GET /recordings/:id/download-url
    Rec-->>Viewer: presigned download URL
```

## Storage Architecture

```mermaid
flowchart LR
    Backend[Backend Service]
    PG[(Postgres)]
    MinIO[(MinIO / S3)]
    Web[Web Client]

    Web -->|stream, event, recording metadata| Backend
    Backend -->|users, devices, links, sessions, events, recordings| PG
    Backend -->|presigned upload/download + object checks| MinIO
    Web -->|PUT / GET via presigned URLs| MinIO
```
