# lo-gr/django-todo architecture

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

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

## Overview

##### Main Components

A. Frontend Layer:
- Templates Directory (/base/templates/base/)
- Static Files (/base/static/base/)
- Main template files:
- main.html (base template)
- task_list.html (main todo view)
- task_form.html (create/edit tasks)
- login.html/register.html (authentication views)

B. Backend Layer:
- URLs/Routing (/base/urls.py, /todo_list/urls.py)
- Views (/base/views.py)
- Models (/base/models.py)
- Admin Interface (/base/admin.py)

C. Database Layer:
- SQLite (Django's default database)
- Migrations (/base/migrations/)

**[User Browser] ←→ [Django Web Server]**
- ↓
**[URL Routing] → [Views Layer] ← [Templates]**
- ↕            ↑
- [Models Layer] → [Static Files]
- ↕
- [Database Layer]

##### Specific Details

A. URL Patterns Layer:
- Main URLs (todo_list/urls.py)
- App URLs (base/urls.py)

B. View Layer:
- Task CRUD operations
- Authentication views (login/register)
- Task list view

C. Template Layer:
- Base template (main.html)
- Task-related templates
- Authentication templates

D. Model Layer:
- Task model
- User model (Django's built-in)

E. Static Files:
- CSS styles (styles.css)

##### Important Relationships to Highlight

- Template inheritance (main.html as base)
- View-Template relationships
- Model-View interactions
- Authentication flow
- Static file serving

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Browser
        User[User Browser]:::external
    end

    subgraph "Web Server Layer"
        WSGI["WSGI Server"]:::server
        ASGI["ASGI Server"]:::server
        Settings["Django Settings"]:::config
    end

    subgraph "URL Routing Layer"
        MainURLs["Main URLs"]:::routing
        AppURLs["App URLs"]:::routing
    end

    subgraph "View Layer"
        Views["Views Controller"]:::backend
        Admin["Admin Interface"]:::backend
    end

    subgraph "Template Layer"
        MainTemplate["Base Template"]:::frontend
        TaskList["Task List View"]:::frontend
        TaskForm["Task Form"]:::frontend
        TaskDelete["Task Delete"]:::frontend
        Login["Login View"]:::frontend
        Register["Register View"]:::frontend
    end

    subgraph "Static Layer"
        CSS["CSS Styles"]:::frontend
    end

    subgraph "Model Layer"
        Models["Data Models"]:::data
        Migrations["Database Migrations"]:::data
    end

    subgraph "Database Layer"
        DB[(SQLite Database)]:::database
    end

    %% Relationships
    User <--> WSGI & ASGI
    WSGI & ASGI --> MainURLs
    MainURLs --> AppURLs
    AppURLs --> Views
    Views --> Admin
    Views <--> Models
    Views --> MainTemplate
    MainTemplate --> TaskList & TaskForm & TaskDelete & Login & Register
    MainTemplate --> CSS
    Models <--> Migrations
    Migrations <--> DB
    Settings --> WSGI & ASGI

    %% Click Events
    click WSGI "https://github.com/Lo-GR/django-todo/blob/main/todo_list/wsgi.py"
    click ASGI "https://github.com/Lo-GR/django-todo/blob/main/todo_list/asgi.py"
    click Settings "https://github.com/Lo-GR/django-todo/blob/main/todo_list/settings.py"
    click MainURLs "https://github.com/Lo-GR/django-todo/blob/main/todo_list/urls.py"
    click AppURLs "https://github.com/Lo-GR/django-todo/blob/main/base/urls.py"
    click Views "https://github.com/Lo-GR/django-todo/blob/main/base/views.py"
    click Admin "https://github.com/Lo-GR/django-todo/blob/main/base/admin.py"
    click MainTemplate "https://github.com/Lo-GR/django-todo/blob/main/base/templates/base/main.html"
    click TaskList "https://github.com/Lo-GR/django-todo/blob/main/base/templates/base/task_list.html"
    click TaskForm "https://github.com/Lo-GR/django-todo/blob/main/base/templates/base/task_form.html"
    click TaskDelete "https://github.com/Lo-GR/django-todo/blob/main/base/templates/base/task_confirm_delete.html"
    click Login "https://github.com/Lo-GR/django-todo/blob/main/base/templates/base/login.html"
    click Register "https://github.com/Lo-GR/django-todo/blob/main/base/templates/base/register.html"
    click CSS "https://github.com/Lo-GR/django-todo/blob/main/base/static/base/styles.css"
    click Models "https://github.com/Lo-GR/django-todo/blob/main/base/models.py"
    click Migrations "https://github.com/Lo-GR/django-todo/tree/main/base/migrations/"

    %% Styling
    classDef external fill:#gray
    classDef server fill:#purple
    classDef config fill:#yellow
    classDef routing fill:#green
    classDef backend fill:#lightgreen
    classDef frontend fill:#lightblue
    classDef data fill:#orange
    classDef database fill:#red

    %% Legend
    subgraph Legend
        L1[External System]:::external
        L2[Server Component]:::server
        L3[Configuration]:::config
        L4[Routing]:::routing
        L5[Backend Logic]:::backend
        L6[Frontend Component]:::frontend
        L7[Data Layer]:::data
        L8[(Database)]:::database
    end
```
