# kalathi18/automatic-question-paper-generator architecture

> Architecture diagram of the GitHub repository kalathi18/automatic-question-paper-generator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kalathi18/automatic-question-paper-generator
- Repository: https://github.com/kalathi18/automatic-question-paper-generator

## Overview

#### Purpose and Runtime

A PHP/MySQL application for maintaining course question banks and producing randomized examination papers. It is intended to run as a server-rendered website under Apache with XAMPP/WAMP; MySQL schema/data are provisioned from `projectdb.sql`, and connection settings are centralized in `config.php`.

#### Web Entry and Session Boundary

`index.php` is the likely public landing/authentication entry point, while `Main.php` serves as the authenticated application hub. `logout.php` terminates the user session. The application’s security boundary is therefore PHP session/auth state between the initial access flow and management/generation pages.

Paths: `index.php`, `Main.php`, `logout.php`

#### Persistence Layer

The system persists courses and categorized questions in MySQL. `projectdb.sql` defines the required database structure, and page-level PHP handlers use the shared database configuration in `config.php`. There is no separate ORM, API service, or migration framework: request handlers directly form the application and persistence layer.

Paths: `config.php`, `projectdb.sql`

#### Course Management

Course records establish the organizational scope for the question bank and paper-generation workflow. `addCourse.php` handles course creation, while `viewCourses.php` exposes existing course data for review and likely selection by downstream question and generation actions.

Paths: `addCourse.php`, `viewCourses.php`

#### Question Bank Management

Questions are entered and categorized through `addQuestion.php`, then inspected via `showQuestions.php`. This is the key content-ingestion boundary: generation depends on sufficiently populated, correctly associated course/question records in MySQL.

Paths: `addQuestion.php`, `showQuestions.php`

#### Paper Discovery and Generation

The primary business flow is course/question-bank selection followed by random, non-repeating question selection and paper output. `findPaper.php` likely supplies the paper/course lookup or selection stage; `generatePaper.php` executes generation and renders a printable/downloadable paper. Randomization occurs in the PHP/MySQL request path rather than in a dedicated background worker.

Paths: `findPaper.php`, `generatePaper.php`

#### Presentation and Deployment Assets

Pages are server-rendered PHP with shared stylesheet assets. The application is deployed as a conventional Apache document-root project, with no indicated container, queue, cloud service, or separate frontend build/runtime.

Paths: `main.css`, `style2.css`, `README.md`

Main entry points: [`Main.php`](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/Main.php) (Authenticated hub), [`config.php`](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/config.php) (Database configuration), [`viewCourses.php`](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/viewCourses.php) (View courses), [`findPaper.php`](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/findPaper.php) (Find paper / select course)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Server-rendered web app"]
  node_index["Landing &amp; authentication<br/>PHP entry page<br/>[index.php]"]
  node_main["Authenticated hub<br/>PHP page<br/>[Main.php]"]
  node_logout["Logout<br/>PHP handler<br/>[logout.php]"]
  node_config["Database configuration<br/>PHP configuration<br/>[config.php]"]
  node_styles["Shared stylesheets<br/>CSS assets<br/>[main.css]"]
end

subgraph group_management["Course &amp; question management"]
  node_add_course["Add course<br/>PHP handler<br/>[addCourse.php]"]
  node_view_courses["View courses<br/>PHP page<br/>[viewCourses.php]"]
  node_add_question["Add categorized question<br/>PHP handler<br/>[addQuestion.php]"]
  node_show_questions["Browse questions<br/>PHP page<br/>[showQuestions.php]"]
end

subgraph group_papers["Paper generation"]
  node_find_paper["Find paper / select course<br/>PHP page<br/>[findPaper.php]"]
  node_generate_paper["Generate randomized paper<br/>PHP handler<br/>[generatePaper.php]"]
end

node_mysql[("Course &amp; question bank<br/>MySQL database<br/>[projectdb.sql]")]
node_readme["Deployment documentation<br/>README<br/>[README.md]"]

node_index -->|"authenticated session"| node_main
node_main -->|"sign out"| node_logout
node_main -->|"manage courses"| node_add_course
node_main -->|"review courses"| node_view_courses
node_main -->|"manage questions"| node_add_question
node_main -->|"browse question bank"| node_show_questions
node_main -->|"find or create paper"| node_find_paper
node_view_courses -->|"course scope"| node_add_question
node_find_paper -->|"selected course"| node_generate_paper
node_config -->|"connects to"| node_mysql
node_add_course -->|"uses"| node_config
node_view_courses -->|"uses"| node_config
node_add_question -->|"uses"| node_config
node_show_questions -->|"uses"| node_config
node_find_paper -->|"uses"| node_config
node_generate_paper -->|"uses"| node_config
node_config -->|"course and question data"| node_mysql
node_main -.->|"renders with"| node_styles

click node_index "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/index.php"
click node_main "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/Main.php"
click node_logout "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/logout.php"
click node_config "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/config.php"
click node_add_course "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/addCourse.php"
click node_view_courses "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/viewCourses.php"
click node_add_question "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/addQuestion.php"
click node_show_questions "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/showQuestions.php"
click node_find_paper "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/findPaper.php"
click node_generate_paper "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/generatePaper.php"
click node_mysql "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/projectdb.sql"
click node_styles "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/main.css"
click node_readme "https://github.com/kalathi18/automatic-question-paper-generator/blob/main/README.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_index,node_main,node_logout,node_config,node_styles toneBlue
class node_add_course,node_view_courses,node_add_question,node_show_questions toneAmber
class node_find_paper,node_generate_paper toneMint
class node_mysql,node_readme toneNeutral
```

## Components

### Server-rendered web app

Apache-hosted PHP pages.

- [Landing & authentication](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/index.php): PHP entry page · Initial access and session-auth boundary. · `index.php`
- [Authenticated hub](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/Main.php): PHP page · Navigation hub for management and generation workflows. · `Main.php`
- [Logout](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/logout.php): PHP handler · Terminates the user session. · `logout.php`
- [Database configuration](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/config.php): PHP configuration · Shared MySQL connection settings. · `config.php`
- [Shared stylesheets](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/main.css): CSS assets · `main.css`

### Course & question management

- [Add course](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/addCourse.php): PHP handler · `addCourse.php`
- [View courses](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/viewCourses.php): PHP page · Reviews and selects course records. · `viewCourses.php`
- [Add categorized question](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/addQuestion.php): PHP handler · Content-ingestion boundary for the question bank. · `addQuestion.php`
- [Browse questions](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/showQuestions.php): PHP page · `showQuestions.php`

### Paper generation

- [Find paper / select course](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/findPaper.php): PHP page · Starts paper lookup and course selection. · `findPaper.php`
- [Generate randomized paper](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/generatePaper.php): PHP handler · Selects non-repeating questions and renders the paper. · `generatePaper.php`

### Other components

- [Course & question bank](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/projectdb.sql): MySQL database · Stores courses, categorized questions, and paper-source data. · `projectdb.sql`
- [Deployment documentation](https://github.com/kalathi18/automatic-question-paper-generator/blob/main/README.md): README · Documents conventional Apache/XAMPP/WAMP deployment. · `README.md`

## Connections

- Landing & authentication → Authenticated hub: authenticated session
- Authenticated hub → Logout: sign out
- Authenticated hub → Add course: manage courses
- Authenticated hub → View courses: review courses
- Authenticated hub → Add categorized question: manage questions
- Authenticated hub → Browse questions: browse question bank
- Authenticated hub → Find paper / select course: find or create paper
- View courses → Add categorized question: course scope
- Find paper / select course → Generate randomized paper: selected course
- Database configuration → Course & question bank: connects to
- Add course → Database configuration: uses
- View courses → Database configuration: uses
- Add categorized question → Database configuration: uses
- Browse questions → Database configuration: uses
- Find paper / select course → Database configuration: uses
- Generate randomized paper → Database configuration: uses
- Database configuration → Course & question bank: course and question data
- Authenticated hub → Shared stylesheets: renders with
