# inwerejosic/flask-ip-reverse architecture

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

- Interactive diagram: https://gitdiagram.com/inwerejosic/flask-ip-reverse
- Repository: https://github.com/inwerejosic/flask-ip-reverse

## Overview

#### Purpose and Entry Point
Flask IP Reverse is a small server-rendered Python service that records visitor IP addresses and renders each address reversed, alongside stored visit history. The application entry point is `app.py`; its browser-facing UI is `templates/index.html`.

#### Web Application Layer
`app.py` owns the Flask application lifecycle, request handling, IP collection, reversal logic, SQLite access, and HTML rendering. Requests enter Flask, derive the visitor address, persist it, query history, then render the template. The primary application boundary is HTTP request/response handling versus local database state.

Paths: `app.py`, `templates/index.html`, `requirements.txt`

#### Persistence
The stated persistence model is SQLite, with visit records retained in `data/visit.db` at runtime. SQLite keeps the service self-contained: no network database or separate persistence process is required. Database durability depends on the runtime/container volume arrangement rather than application code alone.

Paths: `app.py`, `docker-compose.yml`

#### Container Runtime and Local Deployment
Docker is the intended packaging/runtime boundary for the Flask process. Compose provides a local service definition and is the likely place to configure port exposure and persistent storage for SQLite. The README describes a multi-stage Alpine image build, though a `Dockerfile` is not present in the supplied tree and should be treated as a repository gap or external omission.

Paths: `docker-compose.yml`, `app.py`, `requirements.txt`

#### Kubernetes Deployment
A Helm chart packages the service for Kubernetes. The deployment template defines the workload, the service template exposes it inside the cluster, and the namespace template establishes deployment scope. Values centralize environment-specific chart settings.

Paths: `flask-ip-reverse-helm/templates/deployment.yaml`, `flask-ip-reverse-helm/templates/service.yaml`, `flask-ip-reverse-helm/values.yaml`

#### Observability Boundary
The Helm chart includes a ServiceMonitor resource, indicating intended Prometheus-operator discovery of service metrics. Actual metric emission by the Flask process is not established by the supplied tree; the ServiceMonitor is infrastructure-side configuration.

Paths: `flask-ip-reverse-helm/templates/servicemonitor.yaml`, `flask-ip-reverse-helm/templates/service.yaml`

#### Delivery Pipeline and External Services
GitHub Actions builds and publishes container images on pushes to `main` and release tags. Docker Hub is the external image registry target; Kubernetes deployments are expected to consume the resulting image through Helm values.

Paths: `.github/workflows/docker-publish.yml`, `flask-ip-reverse-helm/values.yaml`, `flask-ip-reverse-helm/Chart.yaml`

Main entry points: [`app.py`](https://github.com/inwerejosic/flask-ip-reverse/blob/main/app.py) (Flask request handler), [`flask-ip-reverse-helm/templates/deployment.yaml`](https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/templates/deployment.yaml) (Kubernetes workload), [`flask-ip-reverse-helm/templates/service.yaml`](https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/templates/service.yaml) (Cluster Service), [`docker-compose.yml`](https://github.com/inwerejosic/flask-ip-reverse/blob/main/docker-compose.yml) (Local Compose service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Flask service"]
  node_flask["Flask request handler<br/>Python application<br/>[app.py]"]
  node_template["HTML UI template<br/>Jinja template<br/>[index.html]"]
  node_sqlite[("Visit history<br/>SQLite database")]
  node_dependencies["Python dependencies<br/>dependency manifest<br/>[requirements.txt]"]
end

subgraph group_container["Container runtime"]
  node_compose["Local Compose service<br/>Compose definition<br/>[docker-compose.yml]"]
  node_container_image["Container image<br/>deployable image"]
end

subgraph group_kubernetes["Kubernetes chart"]
  node_chart["Helm chart<br/>chart package<br/>[Chart.yaml]"]
  node_values["Chart values<br/>Helm values<br/>[values.yaml]"]
  node_deployment["Kubernetes workload<br/>Helm deployment template<br/>[deployment.yaml]"]
  node_service["Cluster Service<br/>Helm service template<br/>[service.yaml]"]
  node_kubernetes_cluster{{"Kubernetes cluster<br/>runtime platform"}}
end

subgraph group_delivery["Delivery and observability"]
  node_workflow["Image publish workflow<br/>GitHub Actions<br/>[docker-publish.yml]"]
  node_docker_hub[("Docker Hub<br/>image registry")]
  node_servicemonitor["ServiceMonitor<br/>Prometheus discovery config"]
  node_prometheus_operator{{"Prometheus Operator<br/>metrics platform"}}
end

node_browser(("Browser<br/>client"))

node_browser -->|"HTTP request"| node_flask
node_flask -->|"renders"| node_template
node_flask -->|"stores and queries visits"| node_sqlite
node_dependencies -.->|"provides Flask runtime"| node_flask
node_compose -->|"runs"| node_container_image
node_container_image -->|"packages"| node_flask
node_compose -.->|"may persist via volume"| node_sqlite
node_workflow -->|"builds"| node_container_image
node_workflow -->|"publishes"| node_docker_hub
node_docker_hub -.->|"hosts"| node_container_image
node_chart -->|"uses"| node_values
node_values -->|"configures"| node_deployment
node_deployment -->|"selects image"| node_container_image
node_deployment -->|"creates workload"| node_kubernetes_cluster
node_service -->|"routes to"| node_deployment
node_kubernetes_cluster -->|"hosts"| node_service
node_servicemonitor -->|"discovers"| node_service
node_prometheus_operator -->|"reconciles"| node_servicemonitor

click node_flask "https://github.com/inwerejosic/flask-ip-reverse/blob/main/app.py"
click node_template "https://github.com/inwerejosic/flask-ip-reverse/blob/main/templates/index.html"
click node_dependencies "https://github.com/inwerejosic/flask-ip-reverse/blob/main/requirements.txt"
click node_compose "https://github.com/inwerejosic/flask-ip-reverse/blob/main/docker-compose.yml"
click node_workflow "https://github.com/inwerejosic/flask-ip-reverse/blob/main/.github/workflows/docker-publish.yml"
click node_chart "https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/Chart.yaml"
click node_values "https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/values.yaml"
click node_deployment "https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/templates/deployment.yaml"
click node_service "https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/templates/service.yaml"
click node_servicemonitor "https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/templates/servicemonitor.yaml"

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_template,node_sqlite,node_dependencies toneBlue
class node_compose,node_container_image toneAmber
class node_chart,node_values,node_deployment,node_service,node_kubernetes_cluster toneMint
class node_workflow,node_docker_hub,node_servicemonitor,node_prometheus_operator toneRose
class node_browser toneNeutral
```

## Components

### Flask service

- [Flask request handler](https://github.com/inwerejosic/flask-ip-reverse/blob/main/app.py): Python application · Collects and reverses visitor IPs, persists visits, and renders responses. · `app.py`
- [HTML UI template](https://github.com/inwerejosic/flask-ip-reverse/blob/main/templates/index.html): Jinja template · `templates/index.html`
- **Visit history**: SQLite database · Runtime database retained at data/visit.db.
- [Python dependencies](https://github.com/inwerejosic/flask-ip-reverse/blob/main/requirements.txt): dependency manifest · `requirements.txt`

### Container runtime

- [Local Compose service](https://github.com/inwerejosic/flask-ip-reverse/blob/main/docker-compose.yml): Compose definition · Defines local container runtime, port exposure, and possible volume persistence. · `docker-compose.yml`
- **Container image**: deployable image

### Kubernetes chart

- [Helm chart](https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/Chart.yaml): chart package · `flask-ip-reverse-helm/Chart.yaml`
- [Chart values](https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/values.yaml): Helm values · Centralizes environment-specific settings including image selection. · `flask-ip-reverse-helm/values.yaml`
- [Kubernetes workload](https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/templates/deployment.yaml): Helm deployment template · `flask-ip-reverse-helm/templates/deployment.yaml`
- [Cluster Service](https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/templates/service.yaml): Helm service template · `flask-ip-reverse-helm/templates/service.yaml`
- **Kubernetes cluster**: runtime platform

### Delivery and observability

- [Image publish workflow](https://github.com/inwerejosic/flask-ip-reverse/blob/main/.github/workflows/docker-publish.yml): GitHub Actions · Builds and publishes on main pushes and release tags. · `.github/workflows/docker-publish.yml`
- **Docker Hub**: image registry
- [ServiceMonitor](https://github.com/inwerejosic/flask-ip-reverse/blob/main/flask-ip-reverse-helm/templates/servicemonitor.yaml): Prometheus discovery config · Declares infrastructure-side metric discovery; application metrics are not established. · `flask-ip-reverse-helm/templates/servicemonitor.yaml`
- **Prometheus Operator**: metrics platform

### Other components

- **Browser**: client

## Connections

- Browser → Flask request handler: HTTP request
- Flask request handler → HTML UI template: renders
- Flask request handler → Visit history: stores and queries visits
- Python dependencies → Flask request handler: provides Flask runtime
- Local Compose service → Container image: runs
- Container image → Flask request handler: packages
- Local Compose service → Visit history: may persist via volume
- Image publish workflow → Container image: builds
- Image publish workflow → Docker Hub: publishes
- Docker Hub → Container image: hosts
- Helm chart → Chart values: uses
- Chart values → Kubernetes workload: configures
- Kubernetes workload → Container image: selects image
- Kubernetes workload → Kubernetes cluster: creates workload
- Cluster Service → Kubernetes workload: routes to
- Kubernetes cluster → Cluster Service: hosts
- ServiceMonitor → Cluster Service: discovers
- Prometheus Operator → ServiceMonitor: reconciles
