# 23f2004466/quiz_master architecture

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

- Interactive diagram: https://gitdiagram.com/23f2004466/quiz_master
- Repository: https://github.com/23f2004466/quiz_master

## Overview

##### Project type and purpose
- This is a full-stack web application built with Flask (Python) serving an online quiz platform (e.g., “MentiQuiz”).
- Purpose: Allow admins to manage subjects, quizzes, users, scores; allow users to register, take quizzes, and view results.

##### File structure
- Top-level files:
- app.py: Flask application factory and route registration
- requirements.txt: Python dependencies (e.g., Flask, SQLAlchemy)
- instance/mentiquiz.db: SQLite database file
- Key directories:
- controllers/: request handlers for different user roles (admin.py, auth.py, user.py)
- models/: ORM classes representing DB tables (User, Subject, Quiz, Question, Score, Chapter)
- static/: CSS, JS, images, charts
- templates/: Jinja2 HTML templates (separate subfolders for admin and user views)

##### README for additional insights
- Features implemented: authentication, search, admin dashboard, CRUD for users/subjects/quizzes/scores.

– Admin UI (templates/admin/*.html)
– User UI (templates/user/*.html)
– app.py (router) → controllers/auth.py → login/session
– controllers/admin.py (admin CRUD)
– controllers/user.py (quiz flow)
6. Flask’s static route: Browser → static/ CSS/JS/images.
7. Data flows:
– “Fetch quiz metadata”
– “Submit answers → calculate Score → save Score”
– “Admin Create/Read/Update/Delete on Subjects, Quizzes, Users”

##### Final recommendations
- Be exhaustive: include every major model (User, Subject, Chapter, Quiz, Question, Score).
- Keep component grouping tight: group all template files under a “View Layer” container, all Python code under “Server Layer.”

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser"]:::browser

    subgraph "Frontend Layer"
        subgraph "Admin UI Templates"
            ADash["admin_dashboard.html"]:::template
            MSubj["manage_subject.html"]:::template
            MUsers["manage_users.html"]:::template
            QManage["quiz_manage.html"]:::template
            BaseAdmin["base_admin.html"]:::template
            NavAdmin["navbar_admin.html"]:::template
        end
        subgraph "User UI Templates"
            UDash["user_dashboard.html"]:::template
            QStart["quiz_start.html"]:::template
            VQuiz["view_quiz.html"]:::template
            USum["user_summary.html"]:::template
            BaseUser["base_user.html"]:::template
            NavUser["navbar_user.html"]:::template
        end
        subgraph "Shared Templates"
            Index["index.html"]:::template
            Login["login.html"]:::template
            Register["register.html"]:::template
        end
    end

    Browser -->|"HTTP(S) requests"| FlaskAppRouter["Flask App (app.py)"]:::router

    subgraph "Server Layer"
        FlaskAppRouter --> AuthCtrl["controllers/auth.py"]:::controller
        FlaskAppRouter --> AdminCtrl["controllers/admin.py"]:::controller
        FlaskAppRouter --> UserCtrl["controllers/user.py"]:::controller

        subgraph "Business Logic & Data Models"
            UserModel["models/user.py"]:::model
            SubjectModel["models/subject.py"]:::model
            ChapterModel["models/chapter.py"]:::model
            QuizModel["models/quiz.py"]:::model
            QuestionModel["models/question.py"]:::model
            ScoreModel["models/score.py"]:::model
        end

        AuthCtrl --> UserModel
        AdminCtrl --> SubjectModel
        AdminCtrl --> UserModel
        AdminCtrl --> QuizModel
        AdminCtrl --> ChapterModel
        AdminCtrl --> QuestionModel
        AdminCtrl --> ScoreModel
        UserCtrl --> QuizModel
        UserCtrl --> QuestionModel
        UserCtrl --> ScoreModel

        AuthCtrl -->|"renders templates"| Login
        AuthCtrl -->|"renders templates"| Register
        AdminCtrl -->|"renders templates"| ADash
        AdminCtrl -->|"renders templates"| MSubj
        AdminCtrl -->|"renders templates"| MUsers
        AdminCtrl -->|"renders templates"| QManage
        UserCtrl -->|"renders templates"| UDash
        UserCtrl -->|"renders templates"| QStart
        UserCtrl -->|"renders templates"| VQuiz
        UserCtrl -->|"renders templates"| USum
    end

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

    UserModel --> Database
    SubjectModel --> Database
    ChapterModel --> Database
    QuizModel --> Database
    QuestionModel --> Database
    ScoreModel --> Database

    Browser -->|"Static files"| Static["Static Assets"]:::static
    Static --> Browser

    classDef browser fill:#AEDFF7,stroke:#036F9D,color:#000;
    classDef router fill:#D0E6A5,stroke:#7B9E4C,color:#000;
    classDef controller fill:#FFDDC1,stroke:#D67F00,color:#000;
    classDef model fill:#F7D6E0,stroke:#C93C5E,color:#000;
    classDef database fill:#A5D8D6,stroke:#2E7D7F,color:#000,stroke-width:2px;
    classDef template fill:#E8E9EB,stroke:#6B6B6B,color:#000;
    classDef static fill:#FFE3A3,stroke:#E48B06,color:#000;

    click FlaskAppRouter "https://github.com/23f2004466/quiz_master/blob/main/app.py"
    click AuthCtrl "https://github.com/23f2004466/quiz_master/blob/main/controllers/auth.py"
    click AdminCtrl "https://github.com/23f2004466/quiz_master/blob/main/controllers/admin.py"
    click UserCtrl "https://github.com/23f2004466/quiz_master/blob/main/controllers/user.py"
    click UserModel "https://github.com/23f2004466/quiz_master/blob/main/models/user.py"
    click SubjectModel "https://github.com/23f2004466/quiz_master/blob/main/models/subject.py"
    click ChapterModel "https://github.com/23f2004466/quiz_master/blob/main/models/chapter.py"
    click QuizModel "https://github.com/23f2004466/quiz_master/blob/main/models/quiz.py"
    click QuestionModel "https://github.com/23f2004466/quiz_master/blob/main/models/question.py"
    click ScoreModel "https://github.com/23f2004466/quiz_master/blob/main/models/score.py"
    click Database "https://github.com/23f2004466/quiz_master/blob/main/instance/mentiquiz.db"
    click ADash "https://github.com/23f2004466/quiz_master/blob/main/templates/admin/admin_dashboard.html"
    click MSubj "https://github.com/23f2004466/quiz_master/blob/main/templates/admin/manage_subject.html"
    click MUsers "https://github.com/23f2004466/quiz_master/blob/main/templates/admin/manage_users.html"
    click QManage "https://github.com/23f2004466/quiz_master/blob/main/templates/admin/quiz_manage.html"
    click BaseAdmin "https://github.com/23f2004466/quiz_master/blob/main/templates/base_admin.html"
    click NavAdmin "https://github.com/23f2004466/quiz_master/blob/main/templates/navbar_admin.html"
    click UDash "https://github.com/23f2004466/quiz_master/blob/main/templates/user/user_dashboard.html"
    click QStart "https://github.com/23f2004466/quiz_master/blob/main/templates/user/quiz_start.html"
    click VQuiz "https://github.com/23f2004466/quiz_master/blob/main/templates/user/view_quiz.html"
    click USum "https://github.com/23f2004466/quiz_master/blob/main/templates/user/user_summary.html"
    click BaseUser "https://github.com/23f2004466/quiz_master/blob/main/templates/base_user.html"
    click NavUser "https://github.com/23f2004466/quiz_master/blob/main/templates/navbar_user.html"
    click Index "https://github.com/23f2004466/quiz_master/blob/main/templates/index.html"
    click Login "https://github.com/23f2004466/quiz_master/blob/main/templates/login.html"
    click Register "https://github.com/23f2004466/quiz_master/blob/main/templates/register.html"
    click Static "https://github.com/23f2004466/quiz_master/tree/main/static/"
    click Static "https://github.com/23f2004466/quiz_master/blob/main/static/css/style.css"
    click Static "https://github.com/23f2004466/quiz_master/tree/main/static/charts/"
    click Static "https://github.com/23f2004466/quiz_master/tree/main/static/images/"
    click FlaskAppRouter "https://github.com/23f2004466/quiz_master/blob/main/requirements.txt"
    click FlaskAppRouter "https://github.com/23f2004466/quiz_master/blob/main/.gitignore"
    click FlaskAppRouter "https://github.com/23f2004466/quiz_master/blob/main/README.md"
    click FlaskAppRouter "https://github.com/23f2004466/quiz_master/blob/main/.DS_Store"
```
