# ragu3175/forgeflow architecture

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

- Interactive diagram: https://gitdiagram.com/ragu3175/forgeflow
- Repository: https://github.com/ragu3175/forgeflow

## Overview

ForgeFlow lets users authenticate, submit and manage jobs in a web dashboard; the API persists jobs and idempotency records alongside outbox events, which are relayed to a broker for asynchronous worker execution. The README also describes retries, dead-letter handling, caching, and observability. Edges reflect sampled calls, SOURCE INDEX references, or README-documented relationships; some deployment and telemetry wiring is documented but not visible in sampled runtime code.

Main entry points: [`apps/api/src/services/jobService.ts`](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/services/jobService.ts) (Job service), [`apps/web/src/App.tsx`](https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/App.tsx) (Job dashboard), [`apps/worker/src/queue/consumer.ts`](https://github.com/ragu3175/forgeflow/blob/main/apps/worker/src/queue/consumer.ts) (Queue consumer), [`apps/api/src/db/index.ts`](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/db/index.ts) (PostgreSQL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web dashboard"]
  node_dashboard["Job dashboard<br/>[App.tsx]"]
  node_auth_ui["Auth interface<br/>[AuthModal.tsx]"]
  node_job_ui["Job views<br/>[JobTable.tsx]"]
  node_job_forms["Job submission<br/>[NewJobModal.tsx]"]
  node_auth_context["Session context<br/>[AuthContext.tsx]"]
  node_web_api["HTTP client<br/>[api.ts]"]
end

subgraph group_api["API and persistence"]
  node_api_routes["API routes<br/>[jobRoutes.ts]"]
  node_job_controller["Job controller<br/>[jobController.ts]"]
  node_job_service["Job service<br/>[jobService.ts]"]
  node_auth_controller["Auth controller<br/>[authController.ts]"]
  node_auth_service["Auth service<br/>[authService.ts]"]
  node_repositories["Job and user repositories<br/>[jobRepository.ts]"]
  node_idempotency["Idempotency records"]
  node_outbox_repo["Outbox records"]
  node_postgres[("PostgreSQL<br/>[index.ts]")]
  node_redis[("Redis cache<br/>[jobCache.ts]")]
end

subgraph group_messaging["Messaging"]
  node_outbox_relay["Outbox publisher<br/>[outboxPublisher.ts]"]
  node_rabbit["RabbitMQ<br/>[rabbitmq.ts]"]
  node_retry["Retry and DLQ<br/>[publisher.ts]"]
end

subgraph group_worker["Worker execution"]
  node_consumer["Queue consumer<br/>[consumer.ts]"]
  node_processor["Job processor<br/>[jobProcessor.ts]"]
  node_worker_db[("Worker database<br/>[index.ts]")]
  node_worker_cache[("Worker cache<br/>[redis.ts]")]
end

subgraph group_ops["Observability"]
  node_telemetry["Telemetry stack<br/>[tracing.ts]"]
end

node_user(("User"))

node_user -->|"uses"| node_dashboard
node_dashboard -->|"renders"| node_auth_ui
node_dashboard -->|"renders"| node_job_ui
node_dashboard -->|"renders"| node_job_forms
node_dashboard -->|"requests"| node_web_api
node_auth_ui -->|"uses"| node_auth_context
node_auth_context -->|"requests"| node_web_api
node_web_api -->|"HTTP calls"| node_api_routes
node_api_routes -->|"dispatches"| node_job_controller
node_job_controller -->|"calls"| node_job_service
node_auth_controller -->|"calls"| node_auth_service
node_job_service -->|"reads/writes"| node_repositories
node_job_service -->|"checks"| node_idempotency
node_job_service -->|"creates events"| node_outbox_repo
node_job_service -->|"triggers"| node_outbox_relay
node_job_service -->|"caches jobs"| node_redis
node_auth_service -->|"stores users"| node_postgres
node_repositories -->|"queries"| node_postgres
node_idempotency -->|"queries"| node_postgres
node_outbox_repo -->|"claims events"| node_postgres
node_outbox_relay -->|"claims events"| node_outbox_repo
node_outbox_relay -->|"publishes"| node_rabbit
node_rabbit -->|"delivers jobs"| node_consumer
node_consumer -->|"invokes"| node_processor
node_processor -->|"updates state"| node_worker_db
node_processor -->|"invalidates"| node_worker_cache
node_consumer -->|"routes failures"| node_retry
node_retry -->|"requeues"| node_rabbit
node_consumer -.->|"continues traces"| node_telemetry
node_user -->|"authenticates"| node_auth_controller

click node_dashboard "https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/App.tsx"
click node_auth_ui "https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/components/AuthModal.tsx"
click node_job_ui "https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/components/JobTable.tsx"
click node_job_forms "https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/components/NewJobModal.tsx"
click node_auth_context "https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/context/AuthContext.tsx"
click node_web_api "https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/services/api.ts"
click node_api_routes "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/routes/jobRoutes.ts"
click node_job_controller "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/controllers/jobController.ts"
click node_job_service "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/services/jobService.ts"
click node_auth_controller "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/controllers/authController.ts"
click node_auth_service "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/services/authService.ts"
click node_repositories "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/repositories/jobRepository.ts"
click node_idempotency "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/repositories/idempotencyRepository.ts"
click node_outbox_repo "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/repositories/outboxRepository.ts"
click node_postgres "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/db/index.ts"
click node_redis "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/cache/jobCache.ts"
click node_outbox_relay "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/outbox/outboxPublisher.ts"
click node_rabbit "https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/queue/rabbitmq.ts"
click node_consumer "https://github.com/ragu3175/forgeflow/blob/main/apps/worker/src/queue/consumer.ts"
click node_processor "https://github.com/ragu3175/forgeflow/blob/main/apps/worker/src/processors/jobProcessor.ts"
click node_worker_db "https://github.com/ragu3175/forgeflow/blob/main/apps/worker/src/db/index.ts"
click node_worker_cache "https://github.com/ragu3175/forgeflow/blob/main/apps/worker/src/cache/redis.ts"
click node_retry "https://github.com/ragu3175/forgeflow/blob/main/apps/worker/src/queue/publisher.ts"
click node_telemetry "https://github.com/ragu3175/forgeflow/blob/main/packages/shared/src/tracing.ts"

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_dashboard,node_auth_ui,node_job_ui,node_job_forms,node_auth_context,node_web_api,node_user toneBlue
class node_api_routes,node_job_controller,node_job_service,node_auth_controller,node_auth_service,node_repositories,node_idempotency,node_outbox_repo,node_postgres,node_redis toneAmber
class node_outbox_relay,node_rabbit,node_retry toneMint
class node_consumer,node_processor,node_worker_db,node_worker_cache toneRose
class node_telemetry toneIndigo
```

## Components

### Web dashboard

- [Job dashboard](https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Auth interface](https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/components/AuthModal.tsx): `apps/web/src/components/AuthModal.tsx`
- [Job views](https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/components/JobTable.tsx): `apps/web/src/components/JobTable.tsx`
- [Job submission](https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/components/NewJobModal.tsx): `apps/web/src/components/NewJobModal.tsx`
- [Session context](https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/context/AuthContext.tsx): `apps/web/src/context/AuthContext.tsx`
- [HTTP client](https://github.com/ragu3175/forgeflow/blob/main/apps/web/src/services/api.ts): `apps/web/src/services/api.ts`

### API and persistence

- [API routes](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/routes/jobRoutes.ts): `apps/api/src/routes/jobRoutes.ts`
- [Job controller](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/controllers/jobController.ts): `apps/api/src/controllers/jobController.ts`
- [Job service](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/services/jobService.ts): `apps/api/src/services/jobService.ts`
- [Auth controller](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/controllers/authController.ts): `apps/api/src/controllers/authController.ts`
- [Auth service](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/services/authService.ts): `apps/api/src/services/authService.ts`
- [Job and user repositories](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/repositories/jobRepository.ts): `apps/api/src/repositories/jobRepository.ts`
- [Idempotency records](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/repositories/idempotencyRepository.ts): `apps/api/src/repositories/idempotencyRepository.ts`
- [Outbox records](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/repositories/outboxRepository.ts): `apps/api/src/repositories/outboxRepository.ts`
- [PostgreSQL](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/db/index.ts): `apps/api/src/db/index.ts`
- [Redis cache](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/cache/jobCache.ts): `apps/api/src/cache/jobCache.ts`

### Messaging

- [Outbox publisher](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/outbox/outboxPublisher.ts): `apps/api/src/outbox/outboxPublisher.ts`
- [RabbitMQ](https://github.com/ragu3175/forgeflow/blob/main/apps/api/src/queue/rabbitmq.ts): `apps/api/src/queue/rabbitmq.ts`
- [Retry and DLQ](https://github.com/ragu3175/forgeflow/blob/main/apps/worker/src/queue/publisher.ts): `apps/worker/src/queue/publisher.ts`

### Worker execution

- [Queue consumer](https://github.com/ragu3175/forgeflow/blob/main/apps/worker/src/queue/consumer.ts): `apps/worker/src/queue/consumer.ts`
- [Job processor](https://github.com/ragu3175/forgeflow/blob/main/apps/worker/src/processors/jobProcessor.ts): `apps/worker/src/processors/jobProcessor.ts`
- [Worker database](https://github.com/ragu3175/forgeflow/blob/main/apps/worker/src/db/index.ts): `apps/worker/src/db/index.ts`
- [Worker cache](https://github.com/ragu3175/forgeflow/blob/main/apps/worker/src/cache/redis.ts): `apps/worker/src/cache/redis.ts`

### Observability

- [Telemetry stack](https://github.com/ragu3175/forgeflow/blob/main/packages/shared/src/tracing.ts): `packages/shared/src/tracing.ts`

### Other components

- **User**

## Connections

- User → Job dashboard: uses
- Job dashboard → Auth interface: renders (evidence: `apps/web/src/App.tsx`)
- Job dashboard → Job views: renders (evidence: `apps/web/src/App.tsx`)
- Job dashboard → Job submission: renders (evidence: `apps/web/src/App.tsx`)
- Job dashboard → HTTP client: requests (evidence: `apps/web/src/App.tsx`)
- Auth interface → Session context: uses (evidence: `apps/web/src/components/AuthModal.tsx`)
- Session context → HTTP client: requests (evidence: `apps/web/src/context/AuthContext.tsx`)
- HTTP client → API routes: HTTP calls
- API routes → Job controller: dispatches (evidence: `apps/api/src/routes/jobRoutes.ts`)
- Job controller → Job service: calls (evidence: `apps/api/src/controllers/jobController.ts`)
- Auth controller → Auth service: calls (evidence: `apps/api/src/controllers/authController.ts`)
- Job service → Job and user repositories: reads/writes (evidence: `apps/api/src/services/jobService.ts`)
- Job service → Idempotency records: checks (evidence: `apps/api/src/services/jobService.ts`)
- Job service → Outbox records: creates events (evidence: `apps/api/src/services/jobService.ts`)
- Job service → Outbox publisher: triggers (evidence: `apps/api/src/services/jobService.ts`)
- Job service → Redis cache: caches jobs (evidence: `apps/api/src/services/jobService.ts`)
- Auth service → PostgreSQL: stores users (evidence: `apps/api/src/services/authService.ts`)
- Job and user repositories → PostgreSQL: queries (evidence: `apps/api/src/repositories/jobRepository.ts`)
- Idempotency records → PostgreSQL: queries (evidence: `apps/api/src/repositories/idempotencyRepository.ts`)
- Outbox records → PostgreSQL: claims events (evidence: `apps/api/src/repositories/outboxRepository.ts`)
- Outbox publisher → Outbox records: claims events (evidence: `apps/api/src/outbox/outboxPublisher.ts`)
- Outbox publisher → RabbitMQ: publishes (evidence: `apps/api/src/outbox/outboxPublisher.ts`)
- RabbitMQ → Queue consumer: delivers jobs
- Queue consumer → Job processor: invokes (evidence: `apps/worker/src/queue/consumer.ts`)
- Job processor → Worker database: updates state (evidence: `apps/worker/src/processors/jobProcessor.ts`)
- Job processor → Worker cache: invalidates (evidence: `apps/worker/src/processors/jobProcessor.ts`)
- Queue consumer → Retry and DLQ: routes failures (evidence: `apps/worker/src/queue/consumer.ts`)
- Retry and DLQ → RabbitMQ: requeues
- Queue consumer → Telemetry stack: continues traces
- User → Auth controller: authenticates
