# javiermedinag2/practica-kubernetes architecture

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

- Interactive diagram: https://gitdiagram.com/javiermedinag2/practica-kubernetes
- Repository: https://github.com/javiermedinag2/practica-kubernetes

## Overview

Biblioteca is a small Flask book-catalog application deployed with MongoDB on Kubernetes. Users reach the web service to view the catalog, look up a book by ID, or submit a book; Flask performs the corresponding MongoDB reads and inserts. The manifest also defines MongoDB persistence and a startup wait for database availability. The application and seed script were inspected; deployment relationships are based on the README, not an inspection of the manifest contents.

Main entry points: [`k8s/biblioteca.yaml`](https://github.com/javiermedinag2/practica-kubernetes/blob/main/k8s/biblioteca.yaml) (MongoDB), [`web/app.py`](https://github.com/javiermedinag2/practica-kubernetes/blob/main/web/app.py) (Flask application), [`bd/init-mongo.js`](https://github.com/javiermedinag2/practica-kubernetes/blob/main/bd/init-mongo.js) (Initial books)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Catalog application"]
  node_flask["Flask application<br/>[app.py]"]
  node_welcome["Welcome route<br/>[app.py]"]
  node_catalog_list["List books<br/>[app.py]"]
  node_book_lookup["Find book<br/>[app.py]"]
  node_book_create["Add book<br/>[app.py]"]
end

subgraph group_storage["Book storage"]
  node_mongo[("MongoDB<br/>[biblioteca.yaml]")]
  node_seed_data["Initial books<br/>[init-mongo.js]"]
end

subgraph group_deployment["Kubernetes deployment"]
  node_web_service["Web service<br/>[biblioteca.yaml]"]
  node_mongo_pvc[("Persistent volume<br/>[biblioteca.yaml]")]
  node_web_workload["Flask workload<br/>[biblioteca.yaml]"]
  node_startup_wait["Database wait<br/>[biblioteca.yaml]"]
end

node_reader(("Reader"))

node_reader -->|"requests"| node_web_service
node_web_service -->|"routes to"| node_flask
node_flask -->|"dispatches"| node_welcome
node_flask -->|"dispatches"| node_catalog_list
node_flask -->|"dispatches"| node_book_lookup
node_flask -->|"dispatches"| node_book_create
node_catalog_list -->|"reads books"| node_mongo
node_book_lookup -->|"queries book"| node_mongo
node_book_create -->|"inserts book"| node_mongo
node_seed_data -->|"inserts books"| node_mongo
node_web_workload -->|"serves through"| node_web_service
node_startup_wait -->|"waits for"| node_mongo
node_mongo -->|"stores data on"| node_mongo_pvc

click node_web_service "https://github.com/javiermedinag2/practica-kubernetes/blob/main/k8s/biblioteca.yaml"
click node_flask "https://github.com/javiermedinag2/practica-kubernetes/blob/main/web/app.py"
click node_welcome "https://github.com/javiermedinag2/practica-kubernetes/blob/main/web/app.py"
click node_catalog_list "https://github.com/javiermedinag2/practica-kubernetes/blob/main/web/app.py"
click node_book_lookup "https://github.com/javiermedinag2/practica-kubernetes/blob/main/web/app.py"
click node_book_create "https://github.com/javiermedinag2/practica-kubernetes/blob/main/web/app.py"
click node_mongo "https://github.com/javiermedinag2/practica-kubernetes/blob/main/k8s/biblioteca.yaml"
click node_seed_data "https://github.com/javiermedinag2/practica-kubernetes/blob/main/bd/init-mongo.js"
click node_mongo_pvc "https://github.com/javiermedinag2/practica-kubernetes/blob/main/k8s/biblioteca.yaml"
click node_web_workload "https://github.com/javiermedinag2/practica-kubernetes/blob/main/k8s/biblioteca.yaml"
click node_startup_wait "https://github.com/javiermedinag2/practica-kubernetes/blob/main/k8s/biblioteca.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_welcome,node_catalog_list,node_book_lookup,node_book_create toneBlue
class node_mongo,node_seed_data toneAmber
class node_web_service,node_mongo_pvc,node_web_workload,node_startup_wait toneMint
class node_reader toneIndigo
```

## Components

### Catalog application

- [Flask application](https://github.com/javiermedinag2/practica-kubernetes/blob/main/web/app.py): `web/app.py`
- [Welcome route](https://github.com/javiermedinag2/practica-kubernetes/blob/main/web/app.py): `web/app.py`
- [List books](https://github.com/javiermedinag2/practica-kubernetes/blob/main/web/app.py): `web/app.py`
- [Find book](https://github.com/javiermedinag2/practica-kubernetes/blob/main/web/app.py): `web/app.py`
- [Add book](https://github.com/javiermedinag2/practica-kubernetes/blob/main/web/app.py): `web/app.py`

### Book storage

- [MongoDB](https://github.com/javiermedinag2/practica-kubernetes/blob/main/k8s/biblioteca.yaml): `k8s/biblioteca.yaml`
- [Initial books](https://github.com/javiermedinag2/practica-kubernetes/blob/main/bd/init-mongo.js): `bd/init-mongo.js`

### Kubernetes deployment

- [Web service](https://github.com/javiermedinag2/practica-kubernetes/blob/main/k8s/biblioteca.yaml): `k8s/biblioteca.yaml`
- [Persistent volume](https://github.com/javiermedinag2/practica-kubernetes/blob/main/k8s/biblioteca.yaml): `k8s/biblioteca.yaml`
- [Flask workload](https://github.com/javiermedinag2/practica-kubernetes/blob/main/k8s/biblioteca.yaml): `k8s/biblioteca.yaml`
- [Database wait](https://github.com/javiermedinag2/practica-kubernetes/blob/main/k8s/biblioteca.yaml): `k8s/biblioteca.yaml`

### Other components

- **Reader**

## Connections

- Reader → Web service: requests (evidence: `readme.md`)
- Web service → Flask application: routes to (evidence: `readme.md`)
- Flask application → Welcome route: dispatches (evidence: `web/app.py`)
- Flask application → List books: dispatches (evidence: `web/app.py`)
- Flask application → Find book: dispatches (evidence: `web/app.py`)
- Flask application → Add book: dispatches (evidence: `web/app.py`)
- List books → MongoDB: reads books (evidence: `web/app.py`)
- Find book → MongoDB: queries book (evidence: `web/app.py`)
- Add book → MongoDB: inserts book (evidence: `web/app.py`)
- Initial books → MongoDB: inserts books (evidence: `bd/init-mongo.js`)
- Flask workload → Web service: serves through (evidence: `readme.md`)
- Database wait → MongoDB: waits for (evidence: `readme.md`)
- MongoDB → Persistent volume: stores data on (evidence: `readme.md`)
