# code-with-joker/online_exam_management architecture

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

- Interactive diagram: https://gitdiagram.com/code-with-joker/online_exam_management
- Repository: https://github.com/code-with-joker/online_exam_management

## Overview

##### Project Type and Purpose
- This is a full-stack, server-rendered Django web application named “college_project.”
- It provides two main user interfaces:
a. An Admin Panel (adminPanel app) for staff to manage departments, exams, invigilators, student subjects, etc.
b. A Student Panel (studentPanel app) for students to view/generate admit cards, fee receipts, profile, and check status.
- There’s also a theme app (theme) for Tailwind-powered styling and a Node-based build pipeline for CSS.

##### File Structure Analysis
- Top-level Django project:
- college_project/ – settings.py, urls.py, wsgi.py, asgi.py
- manage.py – entry point for dev commands
- db.sqlite3 – default database
- media/ – user-uploaded files (e.g., profile_pics)
- Django apps:
- adminPanel/ – models, views, URLs, forms, migrations, templates under templates/adminPanel/
- studentPanel/ – models, views, URLs, middleware, migrations, templates under templates/studentPanel/
- theme/ – static_src and static directories housing Tailwind CSS source and built assets, plus base template
- Static assets:
- static/ & staticfiles/ – compiled CSS/JS used in production, Django-browser-reload for dev
- node_modules/, package.json, tailwind.config.js, postcss.config.js – Node/Tailwind build setup
- Templates:
- templates/includes/ – shared partials (toasts)
- templates/adminPanel/ & templates/studentPanel/ – app-specific UI

##### Key Architectural Patterns
- Monolithic Django MVC (MTV) structure:
- Model layer in each app’s models.py
- Templates in templates/
- Views handle HTTP requests, use forms and context to render templates
- URL dispatcher in each app’s urls.py, included in project’s urls.py
- Middleware in studentPanel for cross-cutting concerns (e.g., authentication/authorization checks)
- Static build pipeline: Node → PostCSS/Tailwind → compiled assets → collected by Django’s staticfiles

##### Main System Components
a. Clients
- Web browser (desktop/mobile)
b. Application Server
- WSGI/ASGI layer (gunicorn/uvicorn in production)
- Django core
- URL Router → dispatches to adminPanel or studentPanel views
- Middleware layer
- Apps: adminPanel, studentPanel, theme
c. Database
- SQLite (or configurable via settings)
- Tables for Users, Students, Exams, Departments, FeeReceipts, etc.
d. File Storage
- media/ (profile pictures, QR codes)
- staticfiles/ (collected static assets)
e. Build Pipeline (Offline Component)
- Node.js + Tailwind/PostCSS – compiles theme/static_src → theme/static
- Django collectstatic → staticfiles

##### Relationships and Data Flow
- Browser → HTTP(S) request → WSGI/ASGI server
- Server applies middleware (e.g., session, auth, custom studentPanel middleware)
- URL dispatch:
- /adminPanel/* → adminPanel.views → templates/adminPanel
- /studentPanel/* → studentPanel.views → templates/studentPanel
- Views ↔ Database (ORM queries)
- Views render templates, serve media files as URLs
- Static file requests served from staticfiles/ folder via web server or CDN

##### Architectural Patterns & Design Principles
- Separation of concerns: distinct Django apps per functional area
- DRY templates: includes/partials for reusable UI elements
- MVC/MTV pattern of Django
- Build-time resource pipeline for CSS

##### Final Advice
- Be detailed: capture each Django app, middleware, and the static build process.
- Data flow path: request → view → DB → template → response.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Client
    Browser["Web Browser (Desktop/Mobile)"]:::external

    %% Build Pipeline
    subgraph "Build Pipeline" 
        direction TB
        NodeJS["Node.js + Tailwind/PostCSS"]:::build
        SrcCSS["theme/static_src/"]:::build
        DistCSS["theme/static/css/dist/styles.css"]:::build
        NodeJS -->|"compiles"| SrcCSS -->|"generates"| DistCSS
        click NodeJS "https://github.com/code-with-joker/online_exam_management/blob/main/package.json"
        click SrcCSS "https://github.com/code-with-joker/online_exam_management/tree/main/theme/static_src/"
        click DistCSS "https://github.com/code-with-joker/online_exam_management/blob/main/theme/static/css/dist/styles.css"
    end

    %% Web Application Container
    subgraph "Django Web Application" 
        direction TB
        WSGI["WSGI/ASGI Layer"]:::runtime
        DjangoCore["Django Core\n(settings, URL dispatcher)"]:::runtime
        Middleware["Middleware Stack"]:::runtime
        subgraph "Apps"
            direction TB
            AdminApp["adminPanel App"]:::runtime
            StudentApp["studentPanel App"]:::runtime
            ThemeApp["theme App"]:::runtime
        end
        ORM["ORM & Models"]:::runtime

        Browser -->|"HTTP(S) Request"| WSGI
        WSGI -->|"forwards"| DjangoCore
        DjangoCore -->|"applies"| Middleware
        Middleware -->|"dispatches"| AdminApp
        Middleware -->|"dispatches"| StudentApp
        DjangoCore -->|"loads templates"| ThemeApp
        AdminApp -->|"ORM Queries"| ORM
        StudentApp -->|"ORM Queries"| ORM
        ThemeApp -->|"serves CSS"| DistCSS
        ORM --> DB
        AdminApp --> Media
        StudentApp --> Media
    end

    %% Data Stores
    DB["SQLite Database"]:::db
    Media["Media Storage\n(media/)"]:::storage
    StaticFiles["Static Assets\n(staticfiles/)"]:::storage

    DjangoCore -->|"collectstatic"| StaticFiles

    %% Click Events for Django Core and Apps
    click DjangoCore "https://github.com/code-with-joker/online_exam_management/blob/main/college_project/settings.py"
    click DjangoCore "https://github.com/code-with-joker/online_exam_management/blob/main/college_project/urls.py"
    click WSGI "https://github.com/code-with-joker/online_exam_management/blob/main/college_project/wsgi.py"
    click WSGI "https://github.com/code-with-joker/online_exam_management/blob/main/college_project/asgi.py"
    click Browser "https://github.com/code-with-joker/online_exam_management/blob/main/manage.py"
    click AdminApp "https://github.com/code-with-joker/online_exam_management/tree/main/adminPanel/"
    click AdminApp "https://github.com/code-with-joker/online_exam_management/blob/main/adminPanel/models.py"
    click AdminApp "https://github.com/code-with-joker/online_exam_management/tree/main/adminPanel/migrations/"
    click AdminApp "https://github.com/code-with-joker/online_exam_management/blob/main/adminPanel/views.py"
    click AdminApp "https://github.com/code-with-joker/online_exam_management/blob/main/adminPanel/urls.py"
    click AdminApp "https://github.com/code-with-joker/online_exam_management/blob/main/adminPanel/forms.py"
    click StudentApp "https://github.com/code-with-joker/online_exam_management/tree/main/studentPanel/"
    click StudentApp "https://github.com/code-with-joker/online_exam_management/blob/main/studentPanel/models.py"
    click StudentApp "https://github.com/code-with-joker/online_exam_management/tree/main/studentPanel/migrations/"
    click StudentApp "https://github.com/code-with-joker/online_exam_management/blob/main/studentPanel/views.py"
    click StudentApp "https://github.com/code-with-joker/online_exam_management/blob/main/studentPanel/urls.py"
    click StudentApp "https://github.com/code-with-joker/online_exam_management/blob/main/studentPanel/middleware.py"
    click ThemeApp "https://github.com/code-with-joker/online_exam_management/blob/main/theme/apps.py"
    click ThemeApp "https://github.com/code-with-joker/online_exam_management/blob/main/theme/templates/base.html"
    click StaticFiles "https://github.com/code-with-joker/online_exam_management/tree/main/static/"
    click StaticFiles "https://github.com/code-with-joker/online_exam_management/tree/main/staticfiles/"
    click Media "https://github.com/code-with-joker/online_exam_management/tree/main/media/"

    %% Styles
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px
    classDef build fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef runtime fill:#90EE90,stroke:#333,stroke-width:1px
    classDef storage fill:#98FB98,stroke:#333,stroke-width:1px
    classDef db fill:#66CDAA,stroke:#333,stroke-width:1px
```
