# regcyb1/reddit_orchestrator architecture

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

- Interactive diagram: https://gitdiagram.com/regcyb1/reddit_orchestrator
- Repository: https://github.com/regcyb1/reddit_orchestrator

## Overview

This service schedules recurring subreddit monitoring jobs, fetches posts from an ingestion API, cleans and converts them, and stores posts plus scrape metadata in MongoDB. Operators can access the BlueBerry scheduler API/dashboard; task registration loads enabled subreddit configurations and schedules them. The sampled code supports the scheduled workflow and persistence operations, but does not show dashboard handlers for editing subreddit configurations. BlueBerry internals and the ingestion service are external to this repository.

Main entry points: [`internal/tasks/subreddit_tasks.go`](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/tasks/subreddit_tasks.go) (Subreddit tasks), [`internal/app/app.go`](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/app/app.go) (App wiring), [`internal/storage/mongo_storage.go`](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/storage/mongo_storage.go) (Mongo storage), [`internal/client/ingestion_client.go`](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/client/ingestion_client.go) (Ingestion client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_main["Server entry<br/>[main.go]"]
  node_config["Runtime config<br/>[config.go]"]
  node_app["App wiring<br/>[app.go]"]
end

subgraph group_scheduling["Task scheduling"]
  node_blueberry["BlueBerry scheduler/API<br/>[app.go]"]
  node_taskmanager["Subreddit tasks<br/>[subreddit_tasks.go]"]
end

subgraph group_ingestion["Post ingestion"]
  node_client["Ingestion client"]
  node_ingestionapi{{"Ingestion API"}}
  node_processor["Post processor<br/>[processor.go]"]
  node_models["Domain models<br/>[models.go]"]
end

subgraph group_persistence["MongoDB persistence"]
  node_storage["Mongo storage<br/>[mongo_storage.go]"]
  node_mongodb[("MongoDB")]
end

node_operator(("Operator"))

node_main -->|"initializes"| node_app
node_app -->|"loads"| node_config
node_app -->|"initializes"| node_storage
node_app -->|"starts API"| node_blueberry
node_app -->|"registers tasks"| node_taskmanager
node_app -->|"creates"| node_client
node_app -->|"creates"| node_processor
node_operator -->|"uses dashboard"| node_blueberry
node_taskmanager -->|"reads active configs"| node_storage
node_taskmanager -->|"registers schedules"| node_blueberry
node_blueberry -->|"dispatches task"| node_taskmanager
node_taskmanager -->|"reads scrape metadata"| node_storage
node_taskmanager -->|"fetches posts"| node_client
node_client -->|"requests posts"| node_ingestionapi
node_taskmanager -->|"processes posts"| node_processor
node_taskmanager -->|"writes posts and metadata"| node_storage
node_storage -->|"reads and writes"| node_mongodb
node_blueberry -->|"uses scheduler store"| node_mongodb

click node_main "https://github.com/regcyb1/reddit_orchestrator/blob/main/cmd/server/main.go"
click node_config "https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/config/config.go"
click node_app "https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/app/app.go"
click node_blueberry "https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/app/app.go"
click node_taskmanager "https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/tasks/subreddit_tasks.go"
click node_client "https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/client/ingestion_client.go"
click node_processor "https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/processor/processor.go"
click node_models "https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/models/models.go"
click node_storage "https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/storage/mongo_storage.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_main,node_config,node_app toneBlue
class node_blueberry,node_taskmanager toneAmber
class node_client,node_ingestionapi,node_processor,node_models toneMint
class node_storage,node_mongodb toneRose
class node_operator toneIndigo
```

## Components

### Application runtime

- [Server entry](https://github.com/regcyb1/reddit_orchestrator/blob/main/cmd/server/main.go): `cmd/server/main.go`
- [Runtime config](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/config/config.go): `internal/config/config.go`
- [App wiring](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/app/app.go): `internal/app/app.go`

### Task scheduling

- [BlueBerry scheduler/API](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/app/app.go): `internal/app/app.go`
- [Subreddit tasks](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/tasks/subreddit_tasks.go): `internal/tasks/subreddit_tasks.go`

### Post ingestion

- [Ingestion client](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/client/ingestion_client.go): `internal/client/ingestion_client.go`
- **Ingestion API**
- [Post processor](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/processor/processor.go): `internal/processor/processor.go`
- [Domain models](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/models/models.go): `internal/models/models.go`

### MongoDB persistence

- [Mongo storage](https://github.com/regcyb1/reddit_orchestrator/blob/main/internal/storage/mongo_storage.go): `internal/storage/mongo_storage.go`
- **MongoDB**

### Other components

- **Operator**

## Connections

- Server entry → App wiring: initializes
- App wiring → Runtime config: loads
- App wiring → Mongo storage: initializes
- App wiring → BlueBerry scheduler/API: starts API
- App wiring → Subreddit tasks: registers tasks
- App wiring → Ingestion client: creates
- App wiring → Post processor: creates
- Operator → BlueBerry scheduler/API: uses dashboard
- Subreddit tasks → Mongo storage: reads active configs
- Subreddit tasks → BlueBerry scheduler/API: registers schedules
- BlueBerry scheduler/API → Subreddit tasks: dispatches task
- Subreddit tasks → Mongo storage: reads scrape metadata
- Subreddit tasks → Ingestion client: fetches posts
- Ingestion client → Ingestion API: requests posts
- Subreddit tasks → Post processor: processes posts
- Subreddit tasks → Mongo storage: writes posts and metadata
- Mongo storage → MongoDB: reads and writes
- BlueBerry scheduler/API → MongoDB: uses scheduler store
