# abirbh1/order_tracker architecture

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

- Interactive diagram: https://gitdiagram.com/abirbh1/order_tracker
- Repository: https://github.com/abirbh1/order_tracker

## Overview

Order Tracker lets users create, list, update, and look up orders through a web page and API backed by SQLite. Its observability flow exports application telemetry to a collector and configured backends; Grafana dashboards and alerts expose failures. Firing alerts are handled by a separate incident-response service, which gathers metrics, logs, and traces before optionally launching a coding assistant. The main runtime and incident-response code were excerpted; backend wiring and alert behavior are included where the README documents them.

Main entry points: [`app/main.py`](https://github.com/abirbh1/order_tracker/blob/main/app/main.py) (Order API), [`observability/otel-collector.yaml`](https://github.com/abirbh1/order_tracker/blob/main/observability/otel-collector.yaml) (OTel Collector), [`incident-response/incident_response/context.py`](https://github.com/abirbh1/order_tracker/blob/main/incident-response/incident_response/context.py) (Context collection), [`observability/prometheus.yaml`](https://github.com/abirbh1/order_tracker/blob/main/observability/prometheus.yaml) (Prometheus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orders["Order tracking"]
  node_web["Order page<br/>[index.html]"]
  node_api["Order API<br/>[main.py]"]
  node_ordersdb[("SQLite orders<br/>[main.py]")]
end

subgraph group_telemetry["Telemetry pipeline"]
  node_telemetry_setup["Telemetry setup<br/>[telemetry.py]"]
  node_collector["OTel Collector"]
end

subgraph group_incident["Incident response"]
  node_incident_api["Alert receiver<br/>[app.py]"]
  node_incident_context["Context collection<br/>[context.py]"]
  node_assistant["Coding assistant<br/>[assistant.py]"]
end

subgraph group_analysis["Observability backends"]
  node_prometheus[("Prometheus<br/>[prometheus.yaml]")]
  node_loki[("Loki<br/>[loki.yaml]")]
  node_tempo[("Tempo<br/>[tempo.yaml]")]
  node_grafana["Grafana dashboard<br/>[order-tracker.json]"]
  node_alert_rule["Lookup alert"]
end

node_user(("Order user"))
node_claude["Claude Code"]

node_user -->|"opens"| node_web
node_user -->|"uses API"| node_api
node_web -.->|"requests"| node_api
node_api -->|"reads and writes"| node_ordersdb
node_api -->|"serves"| node_web
node_api -->|"configures"| node_telemetry_setup
node_api -->|"exports telemetry"| node_collector
node_collector -->|"forwards metrics"| node_prometheus
node_collector -->|"forwards logs"| node_loki
node_collector -->|"forwards traces"| node_tempo
node_prometheus -->|"provides data"| node_grafana
node_loki -->|"provides data"| node_grafana
node_tempo -->|"provides data"| node_grafana
node_prometheus -->|"evaluates"| node_alert_rule
node_alert_rule -->|"sends firing alerts"| node_incident_api
node_incident_api -->|"collects context"| node_incident_context
node_incident_api -->|"starts assistant"| node_assistant
node_incident_context -->|"queries metrics"| node_prometheus
node_incident_context -->|"queries logs"| node_loki
node_incident_context -->|"searches traces"| node_tempo
node_assistant -->|"launches process"| node_claude

click node_web "https://github.com/abirbh1/order_tracker/blob/main/static/index.html"
click node_api "https://github.com/abirbh1/order_tracker/blob/main/app/main.py"
click node_ordersdb "https://github.com/abirbh1/order_tracker/blob/main/app/main.py"
click node_telemetry_setup "https://github.com/abirbh1/order_tracker/blob/main/app/telemetry.py"
click node_collector "https://github.com/abirbh1/order_tracker/blob/main/observability/otel-collector.yaml"
click node_prometheus "https://github.com/abirbh1/order_tracker/blob/main/observability/prometheus.yaml"
click node_loki "https://github.com/abirbh1/order_tracker/blob/main/observability/loki.yaml"
click node_tempo "https://github.com/abirbh1/order_tracker/blob/main/observability/tempo.yaml"
click node_grafana "https://github.com/abirbh1/order_tracker/blob/main/observability/grafana/dashboards/order-tracker.json"
click node_alert_rule "https://github.com/abirbh1/order_tracker/blob/main/observability/grafana/provisioning/alerting/order-tracker-alerts.yaml"
click node_incident_api "https://github.com/abirbh1/order_tracker/blob/main/incident-response/incident_response/app.py"
click node_incident_context "https://github.com/abirbh1/order_tracker/blob/main/incident-response/incident_response/context.py"
click node_assistant "https://github.com/abirbh1/order_tracker/blob/main/incident-response/incident_response/assistant.py"

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_api,node_ordersdb,node_user toneBlue
class node_telemetry_setup,node_collector toneAmber
class node_incident_api,node_incident_context,node_assistant toneMint
class node_prometheus,node_loki,node_tempo,node_grafana,node_alert_rule toneRose
class node_claude toneIndigo
```

## Components

### Order tracking

- [Order page](https://github.com/abirbh1/order_tracker/blob/main/static/index.html): `static/index.html`
- [Order API](https://github.com/abirbh1/order_tracker/blob/main/app/main.py): `app/main.py`
- [SQLite orders](https://github.com/abirbh1/order_tracker/blob/main/app/main.py): `app/main.py`

### Telemetry pipeline

- [Telemetry setup](https://github.com/abirbh1/order_tracker/blob/main/app/telemetry.py): `app/telemetry.py`
- [OTel Collector](https://github.com/abirbh1/order_tracker/blob/main/observability/otel-collector.yaml): `observability/otel-collector.yaml`

### Incident response

- [Alert receiver](https://github.com/abirbh1/order_tracker/blob/main/incident-response/incident_response/app.py): `incident-response/incident_response/app.py`
- [Context collection](https://github.com/abirbh1/order_tracker/blob/main/incident-response/incident_response/context.py): `incident-response/incident_response/context.py`
- [Coding assistant](https://github.com/abirbh1/order_tracker/blob/main/incident-response/incident_response/assistant.py): `incident-response/incident_response/assistant.py`

### Observability backends

- [Prometheus](https://github.com/abirbh1/order_tracker/blob/main/observability/prometheus.yaml): `observability/prometheus.yaml`
- [Loki](https://github.com/abirbh1/order_tracker/blob/main/observability/loki.yaml): `observability/loki.yaml`
- [Tempo](https://github.com/abirbh1/order_tracker/blob/main/observability/tempo.yaml): `observability/tempo.yaml`
- [Grafana dashboard](https://github.com/abirbh1/order_tracker/blob/main/observability/grafana/dashboards/order-tracker.json): `observability/grafana/dashboards/order-tracker.json`
- [Lookup alert](https://github.com/abirbh1/order_tracker/blob/main/observability/grafana/provisioning/alerting/order-tracker-alerts.yaml): `observability/grafana/provisioning/alerting/order-tracker-alerts.yaml`

### Other components

- **Order user**
- **Claude Code**

## Connections

- Order user → Order page: opens (evidence: `README.md`)
- Order user → Order API: uses API (evidence: `README.md`)
- Order page → Order API: requests
- Order API → SQLite orders: reads and writes (evidence: `app/main.py`)
- Order API → Order page: serves (evidence: `app/main.py`)
- Order API → Telemetry setup: configures (evidence: `app/main.py`)
- Order API → OTel Collector: exports telemetry (evidence: `README.md`)
- OTel Collector → Prometheus: forwards metrics (evidence: `README.md`)
- OTel Collector → Loki: forwards logs (evidence: `README.md`)
- OTel Collector → Tempo: forwards traces (evidence: `README.md`)
- Prometheus → Grafana dashboard: provides data (evidence: `README.md`)
- Loki → Grafana dashboard: provides data (evidence: `README.md`)
- Tempo → Grafana dashboard: provides data (evidence: `README.md`)
- Prometheus → Lookup alert: evaluates (evidence: `README.md`)
- Lookup alert → Alert receiver: sends firing alerts (evidence: `README.md`)
- Alert receiver → Context collection: collects context (evidence: `incident-response/incident_response/app.py`)
- Alert receiver → Coding assistant: starts assistant (evidence: `incident-response/incident_response/app.py`)
- Context collection → Prometheus: queries metrics (evidence: `incident-response/incident_response/context.py`)
- Context collection → Loki: queries logs (evidence: `incident-response/incident_response/context.py`)
- Context collection → Tempo: searches traces (evidence: `incident-response/incident_response/context.py`)
- Coding assistant → Claude Code: launches process (evidence: `incident-response/incident_response/assistant.py`)
