# raodotsh/todo-cicd-agile architecture

> Architecture diagram of the GitHub repository raodotsh/todo-cicd-agile, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raodotsh/todo-cicd-agile
- Repository: https://github.com/raodotsh/todo-cicd-agile

## Overview

##### Project type and purpose
- This is a monolithic, server-rendered, full-stack web application built on Django (Model-View-Template paradigm).
- It provides a simple “todo” list API and UI, stores tasks in a relational database, and includes Docker and Kubernetes deployment artifacts.

##### File structure
- Top level:
- manage.py (Django CLI entry)
- Dockerfile, docker-compose.yml, .dockerignore, .gitignore
- db.sqlite3 (local development database)
- volume/ (bind-mount volume for persistent storage)
- k8s/ (Kubernetes manifests for both the app and a MySQL DB)
- Django project directory: todoApp/
- settings.py, urls.py, wsgi.py, views.py
- Django app directory: todos/
- models.py, views.py, urls.py, admin.py, migrations/
- templates/ (server-rendered HTML)
- tests.py
- staticfiles/ (collected CSS & other assets)

##### README for additional insights
- Confirms use of SQLite for local development
- Instructions for migrations, running the built-in dev server

##### Main components
a. Client & UI Layer
- Web browser (desktop/mobile) requesting pages under /todos
- HTTP(S) via Ingress or port mapping
b. Web Application Layer
- Django process (Gunicorn or Django dev server)
- WSGI interface (wsgi.py)
- URL routing (todoApp/urls.py → todos/urls.py)
- Views & Templates (todos/views.py + HTML in templates/)
- Static file handler (WhiteNoise or NGINX if added) serving staticfiles/
c. Data Layer
- Local SQLite (db.sqlite3) or
- MySQL pod (k8s/MYSQL-DB manifests: Deployment + Service)
- Persistent volume for database data (volume/store_data/db.sqlite3 or K8s PVC)
d. Containerization & Orchestration
- Docker container for Django app (Dockerfile)
- docker-compose service definitions for app & volume mount
- Kubernetes resources:
- Pod + Deployment for app (k8s/deployment.yaml + pod.yaml)
- Service to expose app (k8s/service.yaml)
- ConfigMap for app settings (if any)
- Secret for database credentials (k8s/MYSQL-DB/secret.yml)

##### Interactions & data flow
- Browser → Ingress/LoadBalancer → Service → Django Pod
- Django → ORM → Database Pod or local .sqlite file via volume mount
- Django → reads static assets from staticfiles/ directory or separate CDN/Service
- ConfigMap/Secret injected into Pod as environment variables for DB connection

##### Architectural patterns & principles
- MVC/MVT: Models (todos/models.py), Views (todos/views.py), Templates (todos/templates/)
- Twelve-factor app: stateless containers, config via environment, backing services (DB) as attached resources
- Container-first design: Docker + Compose for dev, Kubernetes for production

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    Browser["Web Browser"]:::frontend
    Ingress["Ingress / LoadBalancer"]:::network

    Browser -->|"HTTPS /todos"| Ingress

    %% Local Development Environment
    subgraph "Local Development" 
        direction TB
        DC["Docker Compose"]:::container
        DF["Dockerfile"]:::container
        DI[".dockerignore"]:::container
        DJ["Django Container"]:::compute
        MG["manage.py"]:::compute
        SS["SQLite Database (db.sqlite3)"]:::storage
        PV["Persistent Volume (volume/store_data/db.sqlite3)"]:::storage
        GS["Staticfiles (staticfiles/)"]:::storage

        Ingress -->|":8000"| DJ
        DJ -->|ORM Read/Write| SS
        SS --> PV
        DJ -->|Serves CSS/JS| GS
        DC --> DJ
        DF --> DJ
        DI --> DJ
    end

    %% Kubernetes Production Environment
    subgraph "Production (Kubernetes)"
        direction TB
        KG["k8s Manifests"]:::config
        AK["App Deployment (Pod)"]:::compute
        AS["App Service"]:::network
        CM["ConfigMap (k8s/MYSQL-DB/configMap.yml)"]:::config
        SC["Secret (k8s/MYSQL-DB/secret.yml)"]:::secret
        MV["MySQL Deployment"]:::compute
        MS["MySQL Service"]:::network
        MVOL["PVC for MySQL"]:::storage

        Ingress --> AS
        AS --> AK
        AK -->|Env| CM
        AK -->|Env| SC
        AK -->|Reads/Writes via ORM| MS
        MS --> MV
        MV --> MVOL
    end

    %% Django App Internal Components
    subgraph "Django App Container"
        direction TB
        WSGI["WSGI Interface (todoApp/wsgi.py)"]:::compute
        URLP["URL Routing (todoApp/urls.py)"]:::compute
        URLA["URL Routing (todos/urls.py)"]:::compute
        VP["Views (todoApp/views.py)"]:::compute
        VA["Views (todos/views.py)"]:::compute
        TM["Templates (todos/templates/)"]:::frontend
        SA["Static Handler"]:::compute

        AK --> WSGI
        DJ --> WSGI
        WSGI --> URLP
        URLP --> URLA
        URLA --> VP
        URLA --> VA
        VP --> TM
        VA --> TM
        DJ --> SA
        SA --> GS
    end

    %% Click Events
    click MG "https://github.com/raodotsh/todo-cicd-agile/blob/main/manage.py"
    click DF "https://github.com/raodotsh/todo-cicd-agile/tree/main/Dockerfile"
    click DI "https://github.com/raodotsh/todo-cicd-agile/blob/main/.dockerignore"
    click SS "https://github.com/raodotsh/todo-cicd-agile/blob/main/db.sqlite3"
    click PV "https://github.com/raodotsh/todo-cicd-agile/blob/main/volume/store_data/db.sqlite3"
    click CM "https://github.com/raodotsh/todo-cicd-agile/blob/main/k8s/MYSQL-DB/configMap.yml"
    click SC "https://github.com/raodotsh/todo-cicd-agile/blob/main/k8s/MYSQL-DB/secret.yml"
    click MV "https://github.com/raodotsh/todo-cicd-agile/blob/main/k8s/MYSQL-DB/deployment.yml"
    click AK "https://github.com/raodotsh/todo-cicd-agile/blob/main/k8s/deployment.yaml"
    click AS "https://github.com/raodotsh/todo-cicd-agile/blob/main/k8s/service.yaml"
    click KG "https://github.com/raodotsh/todo-cicd-agile/blob/main/k8s/deployment.yaml"
    click WSGI "https://github.com/raodotsh/todo-cicd-agile/blob/main/todoApp/wsgi.py"
    click URLP "https://github.com/raodotsh/todo-cicd-agile/blob/main/todoApp/urls.py"
    click URLA "https://github.com/raodotsh/todo-cicd-agile/blob/main/todos/urls.py"
    click VP "https://github.com/raodotsh/todo-cicd-agile/blob/main/todoApp/views.py"
    click VA "https://github.com/raodotsh/todo-cicd-agile/blob/main/todos/views.py"
    click TM "https://github.com/raodotsh/todo-cicd-agile/blob/main/todos/templates/todos/base.html"
    click TM "https://github.com/raodotsh/todo-cicd-agile/blob/main/todos/templates/todos/index.html"
    click SA "https://github.com/raodotsh/todo-cicd-agile/blob/main/staticfiles/css/style.css"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#1E88E5,color:#0D47A1
    classDef compute fill:#BBDEFB,stroke:#1976D2,color:#0D47A1
    classDef storage fill:#FFE0B2,stroke:#FB8C00,color:#E65100
    classDef network fill:#C8E6C9,stroke:#43A047,color:#1B5E20
    classDef config fill:#C5CAE9,stroke:#3949AB,color:#1A237E
    classDef secret fill:#FFCDD2,stroke:#E53935,color:#B71C1C
    classDef container fill:#B3E5FC,stroke:#0288D1,color:#01579B
```
