# manyuki/flask-docker-stack architecture

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

- Interactive diagram: https://gitdiagram.com/manyuki/flask-docker-stack
- Repository: https://github.com/manyuki/flask-docker-stack

## Overview

This repository is a small, locally containerized Flask API stack. The main request flow serves the root response and exposes metrics; the app also establishes PostgreSQL and Redis connections, though the shown source does not use them for API operations. The README documents Prometheus scraping and Grafana visualization. PostgreSQL, Redis, and Grafana wiring is described but not visible in sampled configuration, so those links rely on README evidence.

Main entry points: [`docker-compose.yml`](https://github.com/manyuki/flask-docker-stack/blob/main/docker-compose.yml) (Compose stack), [`app.py`](https://github.com/manyuki/flask-docker-stack/blob/main/app.py) (Flask API), [`prometheus.yml`](https://github.com/manyuki/flask-docker-stack/blob/main/prometheus.yml) (Prometheus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API"]
  node_flask["Flask API<br/>[app.py]"]
  node_metrics["Metrics endpoint<br/>[app.py]"]
end

subgraph group_data["Data services"]
  node_postgres[("PostgreSQL<br/>[docker-compose.yml]")]
  node_redis[("Redis cache<br/>[docker-compose.yml]")]
end

subgraph group_observability["Observability"]
  node_prometheus["Prometheus<br/>[prometheus.yml]"]
  node_grafana["Grafana<br/>[docker-compose.yml]"]
end

subgraph group_deployment["Deployment"]
  node_compose["Compose stack<br/>[docker-compose.yml]"]
end

node_browser(("Browser"))

node_browser -->|"requests"| node_flask
node_flask -->|"routes to"| node_metrics
node_flask -->|"connects to"| node_postgres
node_flask -->|"connects to"| node_redis
node_prometheus -->|"scrapes"| node_metrics
node_grafana -->|"visualizes"| node_prometheus
node_compose -->|"runs"| node_flask
node_compose -->|"runs"| node_postgres
node_compose -->|"runs"| node_redis
node_compose -->|"runs"| node_prometheus
node_compose -->|"runs"| node_grafana

click node_flask "https://github.com/manyuki/flask-docker-stack/blob/main/app.py"
click node_metrics "https://github.com/manyuki/flask-docker-stack/blob/main/app.py"
click node_postgres "https://github.com/manyuki/flask-docker-stack/blob/main/docker-compose.yml"
click node_redis "https://github.com/manyuki/flask-docker-stack/blob/main/docker-compose.yml"
click node_prometheus "https://github.com/manyuki/flask-docker-stack/blob/main/prometheus.yml"
click node_grafana "https://github.com/manyuki/flask-docker-stack/blob/main/docker-compose.yml"
click node_compose "https://github.com/manyuki/flask-docker-stack/blob/main/docker-compose.yml"

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_flask,node_metrics,node_browser toneBlue
class node_postgres,node_redis toneAmber
class node_prometheus,node_grafana toneMint
class node_compose toneRose
```

## Components

### API

- [Flask API](https://github.com/manyuki/flask-docker-stack/blob/main/app.py): `app.py`
- [Metrics endpoint](https://github.com/manyuki/flask-docker-stack/blob/main/app.py): `app.py`

### Data services

- [PostgreSQL](https://github.com/manyuki/flask-docker-stack/blob/main/docker-compose.yml): `docker-compose.yml`
- [Redis cache](https://github.com/manyuki/flask-docker-stack/blob/main/docker-compose.yml): `docker-compose.yml`

### Observability

- [Prometheus](https://github.com/manyuki/flask-docker-stack/blob/main/prometheus.yml): `prometheus.yml`
- [Grafana](https://github.com/manyuki/flask-docker-stack/blob/main/docker-compose.yml): `docker-compose.yml`

### Deployment

- [Compose stack](https://github.com/manyuki/flask-docker-stack/blob/main/docker-compose.yml): `docker-compose.yml`

### Other components

- **Browser**

## Connections

- Browser → Flask API: requests (evidence: `README.md`)
- Flask API → Metrics endpoint: routes to (evidence: `app.py`)
- Flask API → PostgreSQL: connects to (evidence: `app.py`)
- Flask API → Redis cache: connects to (evidence: `app.py`)
- Prometheus → Metrics endpoint: scrapes (evidence: `README.md`)
- Grafana → Prometheus: visualizes (evidence: `README.md`)
- Compose stack → Flask API: runs (evidence: `README.md`)
- Compose stack → PostgreSQL: runs (evidence: `README.md`)
- Compose stack → Redis cache: runs (evidence: `README.md`)
- Compose stack → Prometheus: runs (evidence: `README.md`)
- Compose stack → Grafana: runs (evidence: `README.md`)
