# abhinavxj/workqueue architecture

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

- Interactive diagram: https://gitdiagram.com/abhinavxj/workqueue
- Repository: https://github.com/abhinavxj/workqueue

## Overview

WorkQueue accepts tasks over HTTP, places them in Redis, and runs them asynchronously in a worker that dispatches by task type. The README also documents worker metrics, concurrent execution, and event logging. Producer behavior is visible in its source; worker internals were not sampled, so worker-side relationships below are based on README statements rather than inspected implementation.

Main entry points: [`cmd/worker/main.go`](https://github.com/abhinavxj/workqueue/blob/main/cmd/worker/main.go) (Worker service), [`cmd/producer/main.go`](https://github.com/abhinavxj/workqueue/blob/main/cmd/producer/main.go) (Producer HTTP API), [`internal/task/task.go`](https://github.com/abhinavxj/workqueue/blob/main/internal/task/task.go) (Task and metrics types), [`internal/worker/worker.go`](https://github.com/abhinavxj/workqueue/blob/main/internal/worker/worker.go) (Concurrent execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Task ingestion"]
  node_producer["Producer HTTP API<br/>[main.go]"]
  node_taskmodel["Task and metrics types<br/>[task.go]"]
  node_redis[("Redis queue")]
end

subgraph group_execution["Task execution"]
  node_worker["Worker service<br/>[main.go]"]
  node_concurrency["Concurrent execution<br/>[worker.go]"]
  node_dispatch["Task-type dispatch<br/>[worker.go]"]
end

subgraph group_operations["Operations"]
  node_metrics["Worker metrics<br/>[main.go]"]
  node_logger["Event logging<br/>[logger.go]"]
end

node_client(("Task client"))

node_client -->|"POST task"| node_producer
node_producer -->|"decodes as"| node_taskmodel
node_producer -->|"pushes task"| node_redis
node_redis -->|"supplies queued jobs"| node_worker
node_worker -->|"runs concurrently"| node_concurrency
node_worker -->|"executes task types"| node_dispatch
node_worker -->|"provides endpoint"| node_metrics
node_worker -->|"logs events"| node_logger

click node_producer "https://github.com/abhinavxj/workqueue/blob/main/cmd/producer/main.go"
click node_taskmodel "https://github.com/abhinavxj/workqueue/blob/main/internal/task/task.go"
click node_worker "https://github.com/abhinavxj/workqueue/blob/main/cmd/worker/main.go"
click node_concurrency "https://github.com/abhinavxj/workqueue/blob/main/internal/worker/worker.go"
click node_dispatch "https://github.com/abhinavxj/workqueue/blob/main/internal/worker/worker.go"
click node_metrics "https://github.com/abhinavxj/workqueue/blob/main/cmd/worker/main.go"
click node_logger "https://github.com/abhinavxj/workqueue/blob/main/internal/logger/logger.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_producer,node_taskmodel,node_redis toneBlue
class node_worker,node_concurrency,node_dispatch toneAmber
class node_metrics,node_logger toneMint
class node_client toneRose
```

## Components

### Task ingestion

- [Producer HTTP API](https://github.com/abhinavxj/workqueue/blob/main/cmd/producer/main.go): `cmd/producer/main.go`
- [Task and metrics types](https://github.com/abhinavxj/workqueue/blob/main/internal/task/task.go): `internal/task/task.go`
- **Redis queue**

### Task execution

- [Worker service](https://github.com/abhinavxj/workqueue/blob/main/cmd/worker/main.go): `cmd/worker/main.go`
- [Concurrent execution](https://github.com/abhinavxj/workqueue/blob/main/internal/worker/worker.go): `internal/worker/worker.go`
- [Task-type dispatch](https://github.com/abhinavxj/workqueue/blob/main/internal/worker/worker.go): `internal/worker/worker.go`

### Operations

- [Worker metrics](https://github.com/abhinavxj/workqueue/blob/main/cmd/worker/main.go): `cmd/worker/main.go`
- [Event logging](https://github.com/abhinavxj/workqueue/blob/main/internal/logger/logger.go): `internal/logger/logger.go`

### Other components

- **Task client**

## Connections

- Task client → Producer HTTP API: POST task (evidence: `README.md`)
- Producer HTTP API → Task and metrics types: decodes as (evidence: `cmd/producer/main.go`)
- Producer HTTP API → Redis queue: pushes task (evidence: `cmd/producer/main.go`)
- Redis queue → Worker service: supplies queued jobs (evidence: `README.md`)
- Worker service → Concurrent execution: runs concurrently (evidence: `README.md`)
- Worker service → Task-type dispatch: executes task types (evidence: `README.md`)
- Worker service → Worker metrics: provides endpoint (evidence: `README.md`)
- Worker service → Event logging: logs events (evidence: `README.md`)
