# aditya-130103/distributed-job-scheduler architecture

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

- Interactive diagram: https://gitdiagram.com/aditya-130103/distributed-job-scheduler
- Repository: https://github.com/aditya-130103/distributed-job-scheduler

## Overview

The product is a distributed job scheduler: users submit configured jobs through the dashboard or API, workers execute and retry them, and exhausted failures reach a dead-letter queue for optional webhook delivery. The graph follows the documented data flow and the sampled dashboard calls. README-described KEDA scaling and Prometheus/Grafana observability are included, but their repository implementation paths are absent from the supplied tree. Backend source excerpts were not supplied, so backend links rely on explicit README statements.

Main entry points: [`backend/api-service/handlers.go`](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/api-service/handlers.go) (REST API Service), [`backend/worker-service/consumer.go`](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/worker-service/consumer.go) (Worker Consumer), [`frontend/dashboard/app/lib/api.ts`](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/frontend/dashboard/app/lib/api.ts) (Dashboard API Client), [`backend/notifier-service/consumer.go`](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/notifier-service/consumer.go) (DLQ Consumer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Dashboard"]
  node_dashboard["Dashboard Views<br/>[page.tsx]"]
  node_job_list["Job List<br/>[page.tsx]"]
  node_job_detail["Job Detail<br/>[page.tsx]"]
  node_job_form["Job Submission Form<br/>[page.tsx]"]
  node_api_client["Dashboard API Client<br/>[api.ts]"]
end

subgraph group_ingestion["Job Ingestion"]
  node_api_service["REST API Service<br/>[handlers.go]"]
  node_api_runtime["API Runtime<br/>[main.go]"]
  node_job_model["Job Data Model<br/>[models.go]"]
  node_postgres[("PostgreSQL Job Store")]
end

subgraph group_execution["Execution and Retry"]
  node_redis["Redis Streams"]
  node_worker["Worker Consumer<br/>[consumer.go]"]
  node_job_executor["Job Type Executor<br/>[executor.go]"]
  node_retry_state["Retry and DLQ Handling<br/>[consumer.go]"]
end

subgraph group_notification["Failure Notifications"]
  node_notifier["DLQ Consumer<br/>[consumer.go]"]
  node_webhook["Webhook Delivery<br/>[webhook.go]"]
end

subgraph group_operations["Operations"]
  node_keda["KEDA Autoscaling"]
  node_prometheus["Prometheus Metrics"]
  node_grafana["Grafana Dashboards"]
end

node_user(("Job User"))
node_callback_service(("Callback Endpoint"))

node_user -->|"uses"| node_dashboard
node_user -->|"submits via API"| node_api_service
node_dashboard -->|"fetches jobs"| node_api_client
node_job_list -->|"fetches jobs"| node_api_client
node_job_detail -->|"reads and cancels"| node_api_client
node_job_form -->|"creates job"| node_api_client
node_api_client -->|"HTTP requests"| node_api_service
node_api_service -->|"inserts jobs"| node_postgres
node_api_service -->|"publishes jobs"| node_redis
node_api_service -.->|"uses job fields"| node_job_model
node_worker -->|"consumes jobs"| node_redis
node_worker -->|"updates job state"| node_postgres
node_worker -.->|"executes job"| node_job_executor
node_worker -.->|"handles outcomes"| node_retry_state
node_retry_state -->|"requeues or publishes DLQ"| node_redis
node_notifier -->|"consumes DLQ"| node_redis
node_notifier -.->|"dispatches callback"| node_webhook
node_webhook -->|"HTTP POST"| node_callback_service
node_keda -->|"scales from pending count"| node_redis
node_api_service -->|"exposes metrics"| node_prometheus
node_worker -.->|"exposes metrics"| node_prometheus
node_notifier -.->|"exposes metrics"| node_prometheus
node_prometheus -->|"supplies monitoring data"| node_grafana

click node_dashboard "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/frontend/dashboard/app/page.tsx"
click node_job_list "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/frontend/dashboard/app/jobs/page.tsx"
click node_job_detail "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/frontend/dashboard/app/jobs/%5Bid%5D/page.tsx"
click node_job_form "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/frontend/dashboard/app/jobs/new/page.tsx"
click node_api_client "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/frontend/dashboard/app/lib/api.ts"
click node_api_service "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/api-service/handlers.go"
click node_api_runtime "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/api-service/main.go"
click node_job_model "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/api-service/models.go"
click node_worker "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/worker-service/consumer.go"
click node_job_executor "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/worker-service/executor.go"
click node_retry_state "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/worker-service/consumer.go"
click node_notifier "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/notifier-service/consumer.go"
click node_webhook "https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/notifier-service/webhook.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_dashboard,node_job_list,node_job_detail,node_job_form,node_api_client,node_user toneBlue
class node_api_service,node_api_runtime,node_job_model,node_postgres toneAmber
class node_redis,node_worker,node_job_executor,node_retry_state toneMint
class node_notifier,node_webhook toneRose
class node_keda,node_prometheus,node_grafana,node_callback_service toneIndigo
```

## Components

### Dashboard

- [Dashboard Views](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/frontend/dashboard/app/page.tsx): `frontend/dashboard/app/page.tsx`
- [Job List](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/frontend/dashboard/app/jobs/page.tsx): `frontend/dashboard/app/jobs/page.tsx`
- [Job Detail](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/frontend/dashboard/app/jobs/%5Bid%5D/page.tsx): `frontend/dashboard/app/jobs/[id]/page.tsx`
- [Job Submission Form](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/frontend/dashboard/app/jobs/new/page.tsx): `frontend/dashboard/app/jobs/new/page.tsx`
- [Dashboard API Client](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/frontend/dashboard/app/lib/api.ts): `frontend/dashboard/app/lib/api.ts`

### Job Ingestion

- [REST API Service](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/api-service/handlers.go): `backend/api-service/handlers.go`
- [API Runtime](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/api-service/main.go): `backend/api-service/main.go`
- [Job Data Model](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/api-service/models.go): `backend/api-service/models.go`
- **PostgreSQL Job Store**

### Execution and Retry

- **Redis Streams**
- [Worker Consumer](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/worker-service/consumer.go): `backend/worker-service/consumer.go`
- [Job Type Executor](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/worker-service/executor.go): `backend/worker-service/executor.go`
- [Retry and DLQ Handling](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/worker-service/consumer.go): `backend/worker-service/consumer.go`

### Failure Notifications

- [DLQ Consumer](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/notifier-service/consumer.go): `backend/notifier-service/consumer.go`
- [Webhook Delivery](https://github.com/aditya-130103/distributed-job-scheduler/blob/main/backend/notifier-service/webhook.go): `backend/notifier-service/webhook.go`

### Operations

- **KEDA Autoscaling**
- **Prometheus Metrics**
- **Grafana Dashboards**

### Other components

- **Job User**
- **Callback Endpoint**

## Connections

- Job User → Dashboard Views: uses
- Job User → REST API Service: submits via API
- Dashboard Views → Dashboard API Client: fetches jobs (evidence: `frontend/dashboard/app/page.tsx`)
- Job List → Dashboard API Client: fetches jobs (evidence: `frontend/dashboard/app/jobs/page.tsx`)
- Job Detail → Dashboard API Client: reads and cancels (evidence: `frontend/dashboard/app/jobs/[id]/page.tsx`)
- Job Submission Form → Dashboard API Client: creates job (evidence: `frontend/dashboard/app/jobs/new/page.tsx`)
- Dashboard API Client → REST API Service: HTTP requests
- REST API Service → PostgreSQL Job Store: inserts jobs
- REST API Service → Redis Streams: publishes jobs
- REST API Service → Job Data Model: uses job fields
- Worker Consumer → Redis Streams: consumes jobs
- Worker Consumer → PostgreSQL Job Store: updates job state
- Worker Consumer → Job Type Executor: executes job
- Worker Consumer → Retry and DLQ Handling: handles outcomes (evidence: `backend/worker-service/consumer.go`)
- Retry and DLQ Handling → Redis Streams: requeues or publishes DLQ
- DLQ Consumer → Redis Streams: consumes DLQ
- DLQ Consumer → Webhook Delivery: dispatches callback
- Webhook Delivery → Callback Endpoint: HTTP POST
- KEDA Autoscaling → Redis Streams: scales from pending count
- REST API Service → Prometheus Metrics: exposes metrics
- Worker Consumer → Prometheus Metrics: exposes metrics
- DLQ Consumer → Prometheus Metrics: exposes metrics
- Prometheus Metrics → Grafana Dashboards: supplies monitoring data
