# sudharsankec/django-todo architecture

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

- Interactive diagram: https://gitdiagram.com/sudharsankec/django-todo
- Repository: https://github.com/sudharsankec/django-todo

## Overview

##### Project type and purpose
- This is a Django-based full-stack web application (MVT pattern).
- It has one app (“app1”) under the project root (“project1”), with multiple user roles (SPM, CTO, Employee) each having dedicated templates and view logic for login, dashboards, and task assignment.

##### File structure
Top-level:
- manage.py – CLI entry point for runserver, migrations, etc.
- project1/ – the Django project folder containing global settings, URL routing, WSGI/ASGI config.
- app1/ – the primary Django application:
– migrations/ – database version history
– models.py – ORM object definitions (employees, roles, tasks)
– views.py – request handlers, role-based logic
– urls.py – app-specific URL patterns
– templates/ – HTML templates organized by role (SPM, CTO, employee)
– static/style.css – shared styling
– admin.py – Django admin registration

##### README
- Minimal (“This is my first django project”). No extra architecture notes, so infer standard Django MVT layering plus role-based modules.

a. Main components
– Client/Browsers (SPM, CTO, Employee)
– Load balancer or reverse proxy (optional, e.g., Nginx)
– WSGI server (Gunicorn/Uvicorn) running the Django app
– Django layers:
- URL Router (project1/urls.py + app1/urls.py)
- Views (app1/views.py)
- Templates (app1/templates/)
- Models & ORM (app1/models.py → SQL DB)
– Database (e.g., SQLite/PostgreSQL)
– Django Admin interface (for superuser operations)
– Static file server (serving style.css)
b. Relationships & interactions
1. Browser sends HTTP(S) → reverse proxy → WSGI server
2. Request enters Django’s URL dispatcher → appropriate view
3. View may:
– Query or update data via Django ORM → Database
– Render an HTML template with context → Response
4. Response returns through proxy to client
5. Static assets may be fetched directly from the static file server
c. Architectural patterns & principles
– MVT (Model-View-Template) separation
– Role-based modules within the same app folder (single-app design)
– Modular URL routing (project-level vs. app-level)
– Migration-driven schema evolution
– Optional: use of middleware for auth/session management
d. Key technologies & frameworks
– Python 3.x, Django framework
– WSGI/ASGI (Gunicorn/Uvicorn)
– Relational DB (SQLite default or PostgreSQL in production)
– HTML/CSS templates under app1/templates
– Django Admin, built-in auth

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        SPM["SPM Browser"]:::client
        CTO["CTO Browser"]:::client
        EMP["Employee Browser"]:::client
    end

    %% Web Server Layer
    subgraph "Web Server Layer"
        direction TB
        NGINX["Nginx (Reverse Proxy)"]:::web
        GUNICORN["Gunicorn (WSGI Server)"]:::web
    end

    %% Django Application Layer
    subgraph "Django Application" 
        direction TB

        CLI["manage.py"]:::django
        click CLI "https://github.com/sudharsankec/django-todo/blob/master/manage.py"

        subgraph "Project Configuration"
            direction TB
            SETTINGS["settings.py"]:::django
            click SETTINGS "https://github.com/sudharsankec/django-todo/blob/master/project1/settings.py"
            PROJECT_URLS["project1/urls.py"]:::django
            click PROJECT_URLS "https://github.com/sudharsankec/django-todo/blob/master/project1/urls.py"
            WSGI["wsgi.py"]:::django
            click WSGI "https://github.com/sudharsankec/django-todo/blob/master/project1/wsgi.py"
            ASGI["asgi.py"]:::django
            click ASGI "https://github.com/sudharsankec/django-todo/blob/master/project1/asgi.py"
        end

        subgraph "App Configuration"
            direction TB
            APPCONF["apps.py"]:::django
            click APPCONF "https://github.com/sudharsankec/django-todo/blob/master/app1/apps.py"
        end

        subgraph "URL Routing"
            direction TB
            APP_URLS["app1/urls.py"]:::django
            click APP_URLS "https://github.com/sudharsankec/django-todo/blob/master/app1/urls.py"
        end

        subgraph "Views"
            direction TB
            VIEWS["views.py"]:::django
            click VIEWS "https://github.com/sudharsankec/django-todo/blob/master/app1/views.py"
        end

        subgraph "Templates"
            direction TB
            SPM_TEMPLATES["SPM Templates"]:::django
            click SPM_TEMPLATES "https://github.com/sudharsankec/django-todo/tree/master/app1/templates/SPM/"
            CTO_TEMPLATES["CTO Templates"]:::django
            click CTO_TEMPLATES "https://github.com/sudharsankec/django-todo/tree/master/app1/templates/cto/"
            EMP_TEMPLATES["Employee Templates"]:::django
            click EMP_TEMPLATES "https://github.com/sudharsankec/django-todo/tree/master/app1/templates/employee/"
            SHARED_TEMPLATE["home.html"]:::django
            click SHARED_TEMPLATE "https://github.com/sudharsankec/django-todo/blob/master/app1/templates/home.html"
        end

        subgraph "Models & Migrations"
            direction TB
            MODELS["models.py"]:::django
            click MODELS "https://github.com/sudharsankec/django-todo/blob/master/app1/models.py"
            subgraph "Migrations"
                direction TB
                M1["0001_initial.py"]:::django
                click M1 "https://github.com/sudharsankec/django-todo/blob/master/app1/migrations/0001_initial.py"
                M2["0002_emp_role.py"]:::django
                click M2 "https://github.com/sudharsankec/django-todo/blob/master/app1/migrations/0002_emp_role.py"
                M3["0003_alter_emp_role_emp_cto.py"]:::django
                click M3 "https://github.com/sudharsankec/django-todo/blob/master/app1/migrations/0003_alter_emp_role_emp_cto.py"
                M4["0004_emp_task.py"]:::django
                click M4 "https://github.com/sudharsankec/django-todo/blob/master/app1/migrations/0004_emp_task.py"
                M5["0005_emp_task1_delete_emp_task.py"]:::django
                click M5 "https://github.com/sudharsankec/django-todo/blob/master/app1/migrations/0005_emp_task1_delete_emp_task.py"
            end
        end

        ADMIN["admin.py"]:::django
        click ADMIN "https://github.com/sudharsankec/django-todo/blob/master/app1/admin.py"

        STATIC["style.css"]:::django
        click STATIC "https://github.com/sudharsankec/django-todo/blob/master/app1/static/style.css"

        TESTS["tests.py"]:::django
        click TESTS "https://github.com/sudharsankec/django-todo/blob/master/app1/tests.py"
    end

    %% Database Layer
    DB["Database (SQLite/PostgreSQL)"]:::db

    %% Static File Server
    STATIC_SRV["Static File Server"]:::web

    %% Connections
    SPM -->|"HTTP/HTTPS"| NGINX
    CTO -->|"HTTP/HTTPS"| NGINX
    EMP -->|"HTTP/HTTPS"| NGINX

    NGINX -->|"WSGI"| GUNICORN
    GUNICORN -->|"Django Entry"| PROJECT_URLS
    PROJECT_URLS -->|"routes to"| APP_URLS
    APP_URLS -->|"calls"| VIEWS
    VIEWS -->|"render/query"| MODELS
    MODELS -->|"ORM"| DB
    VIEWS -->|"render"| SPM_TEMPLATES
    VIEWS -->|"render"| CTO_TEMPLATES
    VIEWS -->|"render"| EMP_TEMPLATES
    VIEWS -->|"render"| SHARED_TEMPLATE

    SPM -->|"GET style.css"| STATIC_SRV
    CTO -->|"GET style.css"| STATIC_SRV
    EMP -->|"GET style.css"| STATIC_SRV
    STATIC_SRV -->|"serves"| STATIC

    ADMIN -->|"manages"| MODELS

    %% Styles
    classDef client fill:#blue,stroke:#000,color:#fff
    classDef web fill:#0f0,stroke:#060,color:#000
    classDef django fill:#ff0,stroke:#cc0,color:#000
    classDef db fill:#f90,stroke:#c60,color:#000
```
