# nareshvetrivel/votify architecture

> Architecture diagram of the GitHub repository nareshvetrivel/votify, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nareshvetrivel/votify
- Repository: https://github.com/nareshvetrivel/votify

## Overview

VOTIFY is a student-election application with student registration and OTP-backed sign-in, candidate selection and voting, plus an administrative election and candidate-management area. The intended student journey spans eligibility checks, identity verification, selection, submission and post-vote handling; administrators manage voters, candidates, election status and results. Shared infrastructure provides MySQL access and email/OTP support. The README is empty, and several workflow endpoints were not sampled, so links among those stages are omitted or marked unverified rather than inferred as confirmed calls.

Main entry points: [`config/database.php`](https://github.com/nareshvetrivel/votify/blob/main/config/database.php) (MySQL database), [`backend/student/register.php`](https://github.com/nareshvetrivel/votify/blob/main/backend/student/register.php) (Registration processing), [`lib/mailer.php`](https://github.com/nareshvetrivel/votify/blob/main/lib/mailer.php) (OTP mailer), [`pages/admin/candidates.php`](https://github.com/nareshvetrivel/votify/blob/main/pages/admin/candidates.php) (Candidate management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["Administration"]
  node_admin_ui["Admin pages"]
  node_candidate_page["Candidate management<br/>[candidates.php]"]
  node_admin_api["Admin operations"]
  node_candidate_api["Add candidate<br/>[add-candidate.php]"]
  node_result_publish["Publish results<br/>[publish-result.php]"]
  node_certificate["Result certificate"]
end

subgraph group_student["Student voting"]
  node_login_page["Student login<br/>[student_login.php]"]
  node_login_gate["Login eligibility check<br/>[check-login.php]"]
  node_register_page["Student registration"]
  node_registration_gate["Registration check"]
  node_student_auth["Student authentication<br/>[login.php]"]
  node_student_register["Registration processing<br/>[register.php]"]
  node_registration_verify["Registration OTP verification"]
  node_selection_page["Candidate selection"]
  node_student_vote_api["Voting operations"]
end

subgraph group_shared["Shared services"]
  node_components["Interface components"]
  node_database[("MySQL database<br/>[database.php]")]
  node_otp["OTP helpers<br/>[otp.php]"]
end

subgraph group_mail["Email delivery"]
  node_mailer["OTP mailer<br/>[mailer.php]"]
  node_phpmailer["PHPMailer<br/>[PHPMailer.php]"]
  node_smtp["SMTP transport<br/>[SMTP.php]"]
  node_email_config["Email configuration<br/>[email.php]"]
end

node_admin_actor(("Election administrator"))
node_student_actor(("Student voter"))

node_student_actor -.->|"opens"| node_login_page
node_student_actor -.->|"opens"| node_register_page
node_admin_actor -.->|"uses"| node_admin_ui
node_login_page -->|"requires"| node_login_gate
node_register_page -->|"checks"| node_registration_gate
node_candidate_page -->|"uses"| node_components
node_candidate_page -->|"queries"| node_database
node_candidate_api -->|"queries"| node_database
node_student_auth -->|"queries"| node_database
node_student_auth -->|"sends OTP"| node_mailer
node_student_register -->|"queries"| node_database
node_student_register -->|"uses"| node_otp
node_student_register -->|"sends OTP"| node_mailer
node_student_register -->|"loads"| node_email_config
node_registration_verify -->|"queries"| node_database
node_registration_verify -->|"uses"| node_otp
node_selection_page -->|"uses"| node_components
node_result_publish -->|"updates"| node_database
node_certificate -->|"fetches status"| node_admin_api
node_mailer -->|"creates mail"| node_phpmailer
node_mailer -->|"uses transport"| node_smtp
node_phpmailer -.->|"uses transport"| node_smtp

click node_admin_ui "https://github.com/nareshvetrivel/votify/tree/main/pages/admin"
click node_candidate_page "https://github.com/nareshvetrivel/votify/blob/main/pages/admin/candidates.php"
click node_admin_api "https://github.com/nareshvetrivel/votify/tree/main/backend/admin"
click node_candidate_api "https://github.com/nareshvetrivel/votify/blob/main/backend/admin/add-candidate.php"
click node_result_publish "https://github.com/nareshvetrivel/votify/blob/main/backend/admin/publish-result.php"
click node_certificate "https://github.com/nareshvetrivel/votify/blob/main/pages/admin/certificate-preview.php"
click node_components "https://github.com/nareshvetrivel/votify/tree/main/components"
click node_login_page "https://github.com/nareshvetrivel/votify/blob/main/pages/student/student_login.php"
click node_login_gate "https://github.com/nareshvetrivel/votify/blob/main/pages/student/check-login.php"
click node_register_page "https://github.com/nareshvetrivel/votify/blob/main/pages/student/student_register.php"
click node_registration_gate "https://github.com/nareshvetrivel/votify/blob/main/pages/student/check-registration.php"
click node_student_auth "https://github.com/nareshvetrivel/votify/blob/main/backend/student/login.php"
click node_student_register "https://github.com/nareshvetrivel/votify/blob/main/backend/student/register.php"
click node_registration_verify "https://github.com/nareshvetrivel/votify/blob/main/backend/student/verify-register-otp.php"
click node_selection_page "https://github.com/nareshvetrivel/votify/blob/main/pages/student/candidate_selection.php"
click node_student_vote_api "https://github.com/nareshvetrivel/votify/tree/main/backend/student"
click node_database "https://github.com/nareshvetrivel/votify/blob/main/config/database.php"
click node_otp "https://github.com/nareshvetrivel/votify/blob/main/lib/otp.php"
click node_mailer "https://github.com/nareshvetrivel/votify/blob/main/lib/mailer.php"
click node_phpmailer "https://github.com/nareshvetrivel/votify/blob/main/lib/PHPMailer/PHPMailer.php"
click node_smtp "https://github.com/nareshvetrivel/votify/blob/main/lib/PHPMailer/SMTP.php"
click node_email_config "https://github.com/nareshvetrivel/votify/blob/main/config/email.php"

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_admin_ui,node_candidate_page,node_admin_api,node_candidate_api,node_result_publish,node_certificate toneBlue
class node_login_page,node_login_gate,node_register_page,node_registration_gate,node_student_auth,node_student_register,node_registration_verify,node_selection_page,node_student_vote_api toneAmber
class node_components,node_database,node_otp toneMint
class node_mailer,node_phpmailer,node_smtp,node_email_config toneRose
class node_admin_actor,node_student_actor toneIndigo
```

## Components

### Administration

- [Admin pages](https://github.com/nareshvetrivel/votify/tree/main/pages/admin): `pages/admin`
- [Candidate management](https://github.com/nareshvetrivel/votify/blob/main/pages/admin/candidates.php): `pages/admin/candidates.php`
- [Admin operations](https://github.com/nareshvetrivel/votify/tree/main/backend/admin): `backend/admin`
- [Add candidate](https://github.com/nareshvetrivel/votify/blob/main/backend/admin/add-candidate.php): `backend/admin/add-candidate.php`
- [Publish results](https://github.com/nareshvetrivel/votify/blob/main/backend/admin/publish-result.php): `backend/admin/publish-result.php`
- [Result certificate](https://github.com/nareshvetrivel/votify/blob/main/pages/admin/certificate-preview.php): `pages/admin/certificate-preview.php`

### Student voting

- [Student login](https://github.com/nareshvetrivel/votify/blob/main/pages/student/student_login.php): `pages/student/student_login.php`
- [Login eligibility check](https://github.com/nareshvetrivel/votify/blob/main/pages/student/check-login.php): `pages/student/check-login.php`
- [Student registration](https://github.com/nareshvetrivel/votify/blob/main/pages/student/student_register.php): `pages/student/student_register.php`
- [Registration check](https://github.com/nareshvetrivel/votify/blob/main/pages/student/check-registration.php): `pages/student/check-registration.php`
- [Student authentication](https://github.com/nareshvetrivel/votify/blob/main/backend/student/login.php): `backend/student/login.php`
- [Registration processing](https://github.com/nareshvetrivel/votify/blob/main/backend/student/register.php): `backend/student/register.php`
- [Registration OTP verification](https://github.com/nareshvetrivel/votify/blob/main/backend/student/verify-register-otp.php): `backend/student/verify-register-otp.php`
- [Candidate selection](https://github.com/nareshvetrivel/votify/blob/main/pages/student/candidate_selection.php): `pages/student/candidate_selection.php`
- [Voting operations](https://github.com/nareshvetrivel/votify/tree/main/backend/student): `backend/student`

### Shared services

- [Interface components](https://github.com/nareshvetrivel/votify/tree/main/components): `components`
- [MySQL database](https://github.com/nareshvetrivel/votify/blob/main/config/database.php): `config/database.php`
- [OTP helpers](https://github.com/nareshvetrivel/votify/blob/main/lib/otp.php): `lib/otp.php`

### Email delivery

- [OTP mailer](https://github.com/nareshvetrivel/votify/blob/main/lib/mailer.php): `lib/mailer.php`
- [PHPMailer](https://github.com/nareshvetrivel/votify/blob/main/lib/PHPMailer/PHPMailer.php): `lib/PHPMailer/PHPMailer.php`
- [SMTP transport](https://github.com/nareshvetrivel/votify/blob/main/lib/PHPMailer/SMTP.php): `lib/PHPMailer/SMTP.php`
- [Email configuration](https://github.com/nareshvetrivel/votify/blob/main/config/email.php): `config/email.php`

### Other components

- **Election administrator**
- **Student voter**

## Connections

- Student voter → Student login: opens
- Student voter → Student registration: opens
- Election administrator → Admin pages: uses
- Student login → Login eligibility check: requires (evidence: `pages/student/student_login.php`)
- Student registration → Registration check: checks (evidence: `pages/student/student_register.php`)
- Candidate management → Interface components: uses (evidence: `pages/admin/candidates.php`)
- Candidate management → MySQL database: queries (evidence: `pages/admin/candidates.php`)
- Add candidate → MySQL database: queries (evidence: `backend/admin/add-candidate.php`)
- Student authentication → MySQL database: queries (evidence: `backend/student/login.php`)
- Student authentication → OTP mailer: sends OTP (evidence: `backend/student/login.php`)
- Registration processing → MySQL database: queries (evidence: `backend/student/register.php`)
- Registration processing → OTP helpers: uses (evidence: `backend/student/register.php`)
- Registration processing → OTP mailer: sends OTP (evidence: `backend/student/register.php`)
- Registration processing → Email configuration: loads (evidence: `backend/student/register.php`)
- Registration OTP verification → MySQL database: queries (evidence: `backend/student/verify-register-otp.php`)
- Registration OTP verification → OTP helpers: uses (evidence: `backend/student/verify-register-otp.php`)
- Candidate selection → Interface components: uses (evidence: `pages/student/candidate_selection.php`)
- Publish results → MySQL database: updates (evidence: `backend/admin/publish-result.php`)
- Result certificate → Admin operations: fetches status (evidence: `pages/admin/certificate-preview.php`)
- OTP mailer → PHPMailer: creates mail (evidence: `lib/mailer.php`)
- OTP mailer → SMTP transport: uses transport (evidence: `lib/mailer.php`)
- PHPMailer → SMTP transport: uses transport (evidence: `lib/PHPMailer/SMTP.php`)
