# lt-inc/terex architecture

> Architecture diagram of the GitHub repository lt-inc/terex, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lt-inc/terex
- Repository: https://github.com/lt-inc/terex

## Overview

Terex is a multi-service media workflow platform: administrators manage video jobs, accounts, publishing schedules, news, and Twitch collection through a web console. The repository also contains separate news and Twitch collectors and a GPU media worker. Sampled source directly establishes the legacy Python API’s database, object-storage, and tracing dependencies, plus the frontend’s backend proxy and Twitch storage handlers. Other service-to-service links are shown as unverified where their wiring was not excerpted.

Main entry points: [`BE/main.py`](https://github.com/lt-inc/terex/blob/master/BE/main.py) (Python API), [`news-collector/internal/transport/http/http.go`](https://github.com/lt-inc/terex/blob/master/news-collector/internal/transport/http/http.go) (News API), [`FE/src/app/admin/calendar/page.tsx`](https://github.com/lt-inc/terex/blob/master/FE/src/app/admin/calendar/page.tsx) (Admin pages), [`FE/src/app/api/[...path]/route.ts`](https://github.com/lt-inc/terex/blob/master/FE/src/app/api/%5B...path%5D/route.ts) (API proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Admin console"]
  node_web["Admin pages<br/>[page.tsx]"]
  node_proxy["API proxy<br/>[route.ts]"]
end

subgraph group_legacy["Legacy publishing"]
  node_api["Python API<br/>[main.py]"]
  node_legacydb[("Legacy records<br/>[db.py]")]
  node_legacyobjects["Legacy assets<br/>[storage.py]"]
  node_tracing["Tracing setup<br/>[tracing.py]"]
end

subgraph group_media["Media processing"]
  node_coordinator["Workflow coordinator<br/>[handlers.go]"]
  node_workflow["Workflow service<br/>[workflow.go]"]
  node_gpuworker["Render workers<br/>[worker.go]"]
  node_renderer["Media renderer<br/>[renderer.go]"]
  node_publisher["Publish workers<br/>[worker.go]"]
  node_gpuassets["Object gateway<br/>[storagegw.go]"]
end

subgraph group_news["News collection"]
  node_newsapi["News API<br/>[http.go]"]
  node_newsingest["News ingestion<br/>[ingest.go]"]
  node_newspublish["News publishing<br/>[publish.go]"]
  node_newsstore[("News records<br/>[store.go]")]
end

subgraph group_twitch["Twitch collection"]
  node_twitchapi["Twitch API<br/>[twitch_storage.go]"]
  node_twitchlifecycle["Storage lifecycle<br/>[service.go]"]
  node_twitchdb[("Twitch records<br/>[twitch_storage.go]")]
  node_twitchcollector["Twitch collector<br/>[service.go]"]
  node_helix["Twitch Helix<br/>[client.go]"]
end

node_admin(("Admin"))
node_operator(("Twitch operator"))

node_admin -->|"manages"| node_web
node_web -.->|"requests API"| node_proxy
node_proxy -->|"forwards requests"| node_api
node_api -->|"reads and writes"| node_legacydb
node_api -->|"uses assets"| node_legacyobjects
node_api -->|"sets up tracing"| node_tracing
node_coordinator -.->|"dispatches workflow"| node_workflow
node_workflow -.->|"queues rendering"| node_gpuworker
node_gpuworker -.->|"runs render"| node_renderer
node_publisher -.->|"uses object storage"| node_gpuassets
node_newsapi -.->|"routes ingestion"| node_newsingest
node_newsapi -.->|"routes publishing"| node_newspublish
node_newsingest -.->|"persists records"| node_newsstore
node_operator -->|"manages storage"| node_twitchapi
node_twitchapi -.->|"requests cleanup"| node_twitchlifecycle
node_twitchlifecycle -.->|"tracks storage"| node_twitchdb
node_twitchcollector -.->|"fetches Twitch data"| node_helix

click node_web "https://github.com/lt-inc/terex/blob/master/FE/src/app/admin/calendar/page.tsx"
click node_proxy "https://github.com/lt-inc/terex/blob/master/FE/src/app/api/%5B...path%5D/route.ts"
click node_api "https://github.com/lt-inc/terex/blob/master/BE/main.py"
click node_legacydb "https://github.com/lt-inc/terex/blob/master/BE/db.py"
click node_legacyobjects "https://github.com/lt-inc/terex/blob/master/BE/storage.py"
click node_tracing "https://github.com/lt-inc/terex/blob/master/BE/tracing.py"
click node_coordinator "https://github.com/lt-inc/terex/blob/master/main-be/internal/transport/http/handlers.go"
click node_workflow "https://github.com/lt-inc/terex/blob/master/main-be/internal/service/workflow/workflow.go"
click node_gpuworker "https://github.com/lt-inc/terex/blob/master/gpu-be/internal/service/renderworker/worker.go"
click node_renderer "https://github.com/lt-inc/terex/blob/master/gpu-be/internal/service/renderer/renderer.go"
click node_publisher "https://github.com/lt-inc/terex/blob/master/gpu-be/internal/service/publishworker/worker.go"
click node_gpuassets "https://github.com/lt-inc/terex/blob/master/gpu-be/internal/service/storagegw/storagegw.go"
click node_newsapi "https://github.com/lt-inc/terex/blob/master/news-collector/internal/transport/http/http.go"
click node_newsingest "https://github.com/lt-inc/terex/blob/master/news-collector/internal/service/ingest.go"
click node_newspublish "https://github.com/lt-inc/terex/blob/master/news-collector/internal/service/publish.go"
click node_newsstore "https://github.com/lt-inc/terex/blob/master/news-collector/internal/repository/postgres/store.go"
click node_twitchapi "https://github.com/lt-inc/terex/blob/master/main-be/internal/transport/http/twitch_storage.go"
click node_twitchlifecycle "https://github.com/lt-inc/terex/blob/master/main-be/internal/service/storagelifecycle/service.go"
click node_twitchdb "https://github.com/lt-inc/terex/blob/master/main-be/internal/repository/postgres/twitch_storage.go"
click node_twitchcollector "https://github.com/lt-inc/terex/blob/master/twitch-collector/internal/service/service.go"
click node_helix "https://github.com/lt-inc/terex/blob/master/twitch-collector/internal/repository/helix/client.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_proxy toneBlue
class node_api,node_legacydb,node_legacyobjects,node_tracing toneAmber
class node_coordinator,node_workflow,node_gpuworker,node_renderer,node_publisher,node_gpuassets toneMint
class node_newsapi,node_newsingest,node_newspublish,node_newsstore toneRose
class node_twitchapi,node_twitchlifecycle,node_twitchdb,node_twitchcollector,node_helix,node_admin,node_operator toneIndigo
```

## Components

### Admin console

- [Admin pages](https://github.com/lt-inc/terex/blob/master/FE/src/app/admin/calendar/page.tsx): `FE/src/app/admin/calendar/page.tsx`
- [API proxy](https://github.com/lt-inc/terex/blob/master/FE/src/app/api/%5B...path%5D/route.ts): `FE/src/app/api/[...path]/route.ts`

### Legacy publishing

- [Python API](https://github.com/lt-inc/terex/blob/master/BE/main.py): `BE/main.py`
- [Legacy records](https://github.com/lt-inc/terex/blob/master/BE/db.py): `BE/db.py`
- [Legacy assets](https://github.com/lt-inc/terex/blob/master/BE/storage.py): `BE/storage.py`
- [Tracing setup](https://github.com/lt-inc/terex/blob/master/BE/tracing.py): `BE/tracing.py`

### Media processing

- [Workflow coordinator](https://github.com/lt-inc/terex/blob/master/main-be/internal/transport/http/handlers.go): `main-be/internal/transport/http/handlers.go`
- [Workflow service](https://github.com/lt-inc/terex/blob/master/main-be/internal/service/workflow/workflow.go): `main-be/internal/service/workflow/workflow.go`
- [Render workers](https://github.com/lt-inc/terex/blob/master/gpu-be/internal/service/renderworker/worker.go): `gpu-be/internal/service/renderworker/worker.go`
- [Media renderer](https://github.com/lt-inc/terex/blob/master/gpu-be/internal/service/renderer/renderer.go): `gpu-be/internal/service/renderer/renderer.go`
- [Publish workers](https://github.com/lt-inc/terex/blob/master/gpu-be/internal/service/publishworker/worker.go): `gpu-be/internal/service/publishworker/worker.go`
- [Object gateway](https://github.com/lt-inc/terex/blob/master/gpu-be/internal/service/storagegw/storagegw.go): `gpu-be/internal/service/storagegw/storagegw.go`

### News collection

- [News API](https://github.com/lt-inc/terex/blob/master/news-collector/internal/transport/http/http.go): `news-collector/internal/transport/http/http.go`
- [News ingestion](https://github.com/lt-inc/terex/blob/master/news-collector/internal/service/ingest.go): `news-collector/internal/service/ingest.go`
- [News publishing](https://github.com/lt-inc/terex/blob/master/news-collector/internal/service/publish.go): `news-collector/internal/service/publish.go`
- [News records](https://github.com/lt-inc/terex/blob/master/news-collector/internal/repository/postgres/store.go): `news-collector/internal/repository/postgres/store.go`

### Twitch collection

- [Twitch API](https://github.com/lt-inc/terex/blob/master/main-be/internal/transport/http/twitch_storage.go): `main-be/internal/transport/http/twitch_storage.go`
- [Storage lifecycle](https://github.com/lt-inc/terex/blob/master/main-be/internal/service/storagelifecycle/service.go): `main-be/internal/service/storagelifecycle/service.go`
- [Twitch records](https://github.com/lt-inc/terex/blob/master/main-be/internal/repository/postgres/twitch_storage.go): `main-be/internal/repository/postgres/twitch_storage.go`
- [Twitch collector](https://github.com/lt-inc/terex/blob/master/twitch-collector/internal/service/service.go): `twitch-collector/internal/service/service.go`
- [Twitch Helix](https://github.com/lt-inc/terex/blob/master/twitch-collector/internal/repository/helix/client.go): `twitch-collector/internal/repository/helix/client.go`

### Other components

- **Admin**
- **Twitch operator**

## Connections

- Admin → Admin pages: manages (evidence: `FE/src/app/admin/calendar/page.tsx`)
- Admin pages → API proxy: requests API
- API proxy → Python API: forwards requests (evidence: `FE/src/app/api/[...path]/route.ts`)
- Python API → Legacy records: reads and writes (evidence: `BE/main.py`)
- Python API → Legacy assets: uses assets (evidence: `BE/main.py`)
- Python API → Tracing setup: sets up tracing (evidence: `BE/main.py`)
- Workflow coordinator → Workflow service: dispatches workflow
- Workflow service → Render workers: queues rendering
- Render workers → Media renderer: runs render
- Publish workers → Object gateway: uses object storage
- News API → News ingestion: routes ingestion
- News API → News publishing: routes publishing
- News ingestion → News records: persists records
- Twitch operator → Twitch API: manages storage (evidence: `main-be/internal/transport/http/twitch_storage.go`)
- Twitch API → Storage lifecycle: requests cleanup
- Storage lifecycle → Twitch records: tracks storage
- Twitch collector → Twitch Helix: fetches Twitch data
