# sakthi582/medical-shop architecture

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

- Interactive diagram: https://gitdiagram.com/sakthi582/medical-shop
- Repository: https://github.com/sakthi582/medical-shop

## Overview

This repository is a DevOps deployment layer for a Flask medical-shop expiry-alert application. The main user workflow is accessing the shop through ingress, using Flask’s medicine and billing functions, and persisting records in MySQL; a separate scheduled check handles expiry alerts. The map also preserves the documented EKS provisioning, host operations, CI/CD, and monitoring capabilities. Application internals are only sampled in part, so feature-level links beyond the excerpts rely on README statements rather than unsampled route inspection.

Main entry points: [`app.py`](https://github.com/sakthi582/medical-shop/blob/main/app.py) (Flask application), [`k8s/deployment.yml`](https://github.com/sakthi582/medical-shop/blob/main/k8s/deployment.yml) (Flask deployment), [`database.py`](https://github.com/sakthi582/medical-shop/blob/main/database.py) (Schema initialization), [`k8s/ingress.yml`](https://github.com/sakthi582/medical-shop/blob/main/k8s/ingress.yml) (Ingress)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Shop application"]
  node_flask["Flask application<br/>[app.py]"]
  node_web_ui["Shop templates"]
  node_billing_ui["Billing cart<br/>[script.js]"]
  node_configuration["App configuration<br/>[config.py]"]
  node_schema_init["Schema initialization<br/>[database.py]"]
end

subgraph group_runtime["Kubernetes runtime"]
  node_ingress["Ingress<br/>[ingress.yml]"]
  node_expiry_check["Expiry alert job<br/>[expiry-cronjob.yml]"]
  node_mysql[("MySQL database<br/>[mysql.yml]")]
  node_k8s_app["Flask deployment<br/>[deployment.yml]"]
  node_k8s_service["Flask service<br/>[service.yml]"]
end

subgraph group_observability["Monitoring"]
  node_prometheus["Prometheus"]
  node_grafana["Grafana<br/>[deployment.yml]"]
end

subgraph group_infrastructure["Infrastructure operations"]
  node_terraform["EKS provisioning<br/>[main.tf]"]
  node_ansible["Host operations<br/>[main.yml]"]
end

subgraph group_delivery["CI/CD delivery"]
  node_pipeline["CI/CD workflow<br/>[ci-cd.yml]"]
end

node_shopper(("Shop user"))
node_smtp["SMTP service"]
node_aws_eks["AWS EKS"]

node_shopper -->|"accesses"| node_ingress
node_ingress -->|"routes traffic"| node_k8s_service
node_k8s_service -->|"forwards traffic"| node_k8s_app
node_k8s_app -->|"runs"| node_flask
node_flask -->|"serves presentation"| node_web_ui
node_billing_ui -.->|"submits billing"| node_flask
node_flask -->|"reads and writes"| node_mysql
node_flask -->|"loads settings"| node_configuration
node_schema_init -->|"loads settings"| node_configuration
node_schema_init -->|"creates schema"| node_mysql
node_expiry_check -->|"runs expiry check"| node_flask
node_flask -->|"sends alerts"| node_smtp
node_prometheus -->|"scrapes metrics"| node_k8s_app
node_grafana -->|"visualizes metrics"| node_prometheus
node_terraform -->|"provisions cluster"| node_aws_eks
node_pipeline -->|"deploys application"| node_k8s_app
node_ansible -.->|"supports host operations"| node_aws_eks

click node_ingress "https://github.com/sakthi582/medical-shop/blob/main/k8s/ingress.yml"
click node_flask "https://github.com/sakthi582/medical-shop/blob/main/app.py"
click node_web_ui "https://github.com/sakthi582/medical-shop/tree/main/templates"
click node_billing_ui "https://github.com/sakthi582/medical-shop/blob/main/static/js/script.js"
click node_configuration "https://github.com/sakthi582/medical-shop/blob/main/config.py"
click node_expiry_check "https://github.com/sakthi582/medical-shop/blob/main/k8s/expiry-cronjob.yml"
click node_mysql "https://github.com/sakthi582/medical-shop/blob/main/k8s/mysql.yml"
click node_schema_init "https://github.com/sakthi582/medical-shop/blob/main/database.py"
click node_k8s_app "https://github.com/sakthi582/medical-shop/blob/main/k8s/deployment.yml"
click node_k8s_service "https://github.com/sakthi582/medical-shop/blob/main/k8s/service.yml"
click node_prometheus "https://github.com/sakthi582/medical-shop/blob/main/monitering/prometheus-deployment.yml"
click node_grafana "https://github.com/sakthi582/medical-shop/blob/main/monitering/grafana/deployment.yml"
click node_terraform "https://github.com/sakthi582/medical-shop/blob/main/terraform/main.tf"
click node_ansible "https://github.com/sakthi582/medical-shop/blob/main/ansible/roles/common/tasks/main.yml"
click node_pipeline "https://github.com/sakthi582/medical-shop/blob/main/.github/workflows/ci-cd.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_web_ui,node_billing_ui,node_configuration,node_schema_init,node_shopper toneBlue
class node_ingress,node_expiry_check,node_mysql,node_k8s_app,node_k8s_service toneAmber
class node_prometheus,node_grafana toneMint
class node_terraform,node_ansible toneRose
class node_pipeline,node_smtp,node_aws_eks toneIndigo
```

## Components

### Shop application

- [Flask application](https://github.com/sakthi582/medical-shop/blob/main/app.py): `app.py`
- [Shop templates](https://github.com/sakthi582/medical-shop/tree/main/templates): `templates`
- [Billing cart](https://github.com/sakthi582/medical-shop/blob/main/static/js/script.js): `static/js/script.js`
- [App configuration](https://github.com/sakthi582/medical-shop/blob/main/config.py): `config.py`
- [Schema initialization](https://github.com/sakthi582/medical-shop/blob/main/database.py): `database.py`

### Kubernetes runtime

- [Ingress](https://github.com/sakthi582/medical-shop/blob/main/k8s/ingress.yml): `k8s/ingress.yml`
- [Expiry alert job](https://github.com/sakthi582/medical-shop/blob/main/k8s/expiry-cronjob.yml): `k8s/expiry-cronjob.yml`
- [MySQL database](https://github.com/sakthi582/medical-shop/blob/main/k8s/mysql.yml): `k8s/mysql.yml`
- [Flask deployment](https://github.com/sakthi582/medical-shop/blob/main/k8s/deployment.yml): `k8s/deployment.yml`
- [Flask service](https://github.com/sakthi582/medical-shop/blob/main/k8s/service.yml): `k8s/service.yml`

### Monitoring

- [Prometheus](https://github.com/sakthi582/medical-shop/blob/main/monitering/prometheus-deployment.yml): `monitering/prometheus-deployment.yml`
- [Grafana](https://github.com/sakthi582/medical-shop/blob/main/monitering/grafana/deployment.yml): `monitering/grafana/deployment.yml`

### Infrastructure operations

- [EKS provisioning](https://github.com/sakthi582/medical-shop/blob/main/terraform/main.tf): `terraform/main.tf`
- [Host operations](https://github.com/sakthi582/medical-shop/blob/main/ansible/roles/common/tasks/main.yml): `ansible/roles/common/tasks/main.yml`

### CI/CD delivery

- [CI/CD workflow](https://github.com/sakthi582/medical-shop/blob/main/.github/workflows/ci-cd.yml): `.github/workflows/ci-cd.yml`

### Other components

- **Shop user**
- **SMTP service**
- **AWS EKS**

## Connections

- Shop user → Ingress: accesses (evidence: `README.md`)
- Ingress → Flask service: routes traffic (evidence: `README.md`)
- Flask service → Flask deployment: forwards traffic (evidence: `README.md`)
- Flask deployment → Flask application: runs (evidence: `README.md`)
- Flask application → Shop templates: serves presentation (evidence: `README.md`)
- Billing cart → Flask application: submits billing
- Flask application → MySQL database: reads and writes (evidence: `README.md`)
- Flask application → App configuration: loads settings (evidence: `app.py`)
- Schema initialization → App configuration: loads settings (evidence: `database.py`)
- Schema initialization → MySQL database: creates schema (evidence: `README.md`)
- Expiry alert job → Flask application: runs expiry check (evidence: `README.md`)
- Flask application → SMTP service: sends alerts (evidence: `README.md`)
- Prometheus → Flask deployment: scrapes metrics (evidence: `README.md`)
- Grafana → Prometheus: visualizes metrics (evidence: `README.md`)
- EKS provisioning → AWS EKS: provisions cluster (evidence: `README.md`)
- CI/CD workflow → Flask deployment: deploys application (evidence: `README.md`)
- Host operations → AWS EKS: supports host operations (evidence: `README.md`)
