# nkosinathiz/student_planner-app architecture

> Architecture diagram of the GitHub repository nkosinathiz/student_planner-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nkosinathiz/student_planner-app
- Repository: https://github.com/nkosinathiz/student_planner-app

## Overview

##### Project Type & Purpose
- Type: Full-stack web application built with Django (MVT pattern).
- Purpose: A student productivity and wellness planner featuring task tracking, smart scheduling, emotional diary, and a dynamic calendar.

##### Main Components
a. Presentation Layer (Frontend)
- HTML templates in student_app/templates (home.html, notes.html, schedule.html, etc.)
- CSS styles (inline or static directory if added)
- JavaScript snippets for real-time clock and dynamic calendar updates
- Browser/UI client
b. Application Layer (Backend)
- Django project: student_planner/
- settings.py (configuration, middleware, installed apps)
- urls.py (root URL router)
- wsgi.py / asgi.py (deployment entry points)
- Django app: student_app/
- models.py (Task, Note, Schedule, UserProfile, etc.)
- views.py (functions or class-based views handling requests)
- urls.py (app-specific URL patterns)
- admin.py (Django admin registration)
- tests.py (unit tests)
c. Data Layer
- SQLite database (db.sqlite3) storing users, tasks, schedules, diary entries
- Django ORM handling SQL queries
d. (Optional) External/Infrastructure Services
- Authentication (built-in Django auth using admin/admin for now)
- Future integrations: email/SMS reminders, third-party calendar APIs

##### Component Relationships & Data Flows
- User via Browser ➔ HTTP requests (GET/POST) to Django URLs (student_planner/urls.py → student_app/urls.py)
- URL dispatcher maps to Views ➔ Views invoke Models (ORM) to read/write db.sqlite3
- Views render Templates (HTML/CSS/JS) with context data and return HTTP responses
- JavaScript in templates can call additional HTTP endpoints (AJAX) for dynamic calendar or task updates
- manage.py as CLI entry for migrations, dev server, testing

##### Architectural Patterns & Design Principles
- Model-View-Template (MVT): clear separation of data (models), business logic/controllers (views), and presentation (templates)
- Single Django project containing one primary app (student_app) — easy to split into multiple apps if features grow
- RESTful-style URL endpoints (e.g., /tasks/create/, /notes/) for CRUD operations
- Use of Django admin for quick data inspection and management

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        Browser["Browser / UI"]:::client
        subgraph "Templates" 
            direction TB
            Templates_Home["home.html"]:::code
            Templates_Notes["notes.html"]:::code
            Templates_Schedule["schedule.html"]:::code
            Templates_About["about.html"]:::code
            Templates_Login["login.html"]:::code
            Templates_Main["main.html"]:::code
        end
        subgraph "Static / JS" 
            direction TB
            JS_Inline["JS Snippets (clock, dynamic calendar)"]:::code
        end
    end

    %% Application Layer
    subgraph "Application Layer" 
        direction TB
        subgraph "Django Project (student_planner)" 
            direction TB
            Config_Settings["settings.py"]:::code
            Config_URLs["urls.py"]:::code
            Config_WSGI["wsgi.py"]:::code
            Config_ASGI["asgi.py"]:::code
        end
        subgraph "Django App (student_app)"
            direction TB
            App_Models["models.py"]:::code
            App_Views["views.py"]:::code
            App_URLs["urls.py"]:::code
            App_Admin["admin.py"]:::code
            App_Tests["tests.py"]:::code
            App_Apps["apps.py"]:::code
            subgraph "Migrations" 
                direction TB
                Migrations_Folder["student_app/migrations/"]:::code
            end
        end
        CLI["manage.py"]:::code
    end

    %% Data Layer
    subgraph "Data Layer" 
        direction TB
        Database["db.sqlite3"]:::db
    end

    %% Data Flows
    Browser -->|"HTTP GET/POST"| Config_URLs
    Config_URLs -->|"route to app"| App_URLs
    App_URLs -->|"invoke view"| App_Views
    App_Views -->|"ORM Query"| App_Models
    App_Models -->|"read/write"| Database
    Database -->|"data result"| App_Models
    App_Models -->|"return data"| App_Views
    App_Views -->|"render HTML"| Templates_Home
    App_Views -->|"render HTML"| Templates_Notes
    App_Views -->|"render HTML"| Templates_Schedule
    App_Views -->|"render HTML"| Templates_About
    App_Views -->|"render HTML"| Templates_Login
    App_Views -->|"render HTML"| Templates_Main
    Templates_Home -->|"HTTP Response"| Browser
    Templates_Notes -->|"HTTP Response"| Browser
    Templates_Schedule -->|"HTTP Response"| Browser
    Templates_About -->|"HTTP Response"| Browser
    Templates_Login -->|"HTTP Response"| Browser
    Templates_Main -->|"HTTP Response"| Browser
    Browser -->|"AJAX"| JS_Inline
    JS_Inline -->|"HTTP Endpoint"| App_Views

    %% Click Events
    click Templates_Home "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/templates/home.html"
    click Templates_Notes "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/templates/notes.html"
    click Templates_Schedule "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/templates/schedule.html"
    click Templates_About "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/templates/about.html"
    click Templates_Login "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/templates/login.html"
    click Templates_Main "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/templates/main.html"
    click Config_Settings "https://github.com/nkosinathiz/student_planner-app/blob/main/student_planner/settings.py"
    click Config_URLs "https://github.com/nkosinathiz/student_planner-app/blob/main/student_planner/urls.py"
    click Config_WSGI "https://github.com/nkosinathiz/student_planner-app/blob/main/student_planner/wsgi.py"
    click Config_ASGI "https://github.com/nkosinathiz/student_planner-app/blob/main/student_planner/asgi.py"
    click App_Models "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/models.py"
    click App_Views "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/views.py"
    click App_URLs "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/urls.py"
    click App_Admin "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/admin.py"
    click App_Tests "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/tests.py"
    click App_Apps "https://github.com/nkosinathiz/student_planner-app/blob/main/student_app/apps.py"
    click Migrations_Folder "https://github.com/nkosinathiz/student_planner-app/tree/main/student_app/migrations/"
    click CLI "https://github.com/nkosinathiz/student_planner-app/blob/main/manage.py"
    click Database "https://github.com/nkosinathiz/student_planner-app/blob/main/db.sqlite3"

    %% Styles
    classDef client fill:#FFA500,stroke:#333,stroke-width:1px
    classDef code fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef db fill:#90EE90,stroke:#333,stroke-width:1px
```
