# abdulrehmangulfaraz/english-learning-hub architecture

> Architecture diagram of the GitHub repository abdulrehmangulfaraz/english-learning-hub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdulrehmangulfaraz/english-learning-hub
- Repository: https://github.com/abdulrehmangulfaraz/english-learning-hub

## Overview

English Learning Hub is an online English-class enrollment application with an admin area for reviewing and managing submissions. Applicants complete a form with personal, course, and identity-document details; the form posts enrollment data to an API, which validates required document URLs and persists the record. Admins authenticate, browse submissions, export CSV, download individual PDF records, or delete entries. The excerpts show the enrollment, persistence, and admin flows, but do not establish how document URLs are uploaded or where those files are hosted.

Main entry points: [`app/admin/page.tsx`](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/page.tsx) (Enrollment Dashboard), [`app/admin/actions.ts`](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/actions.ts) (Admin Actions), [`lib/mongodb.ts`](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/lib/mongodb.ts) (MongoDB Connection), [`app/api/enroll/route.ts`](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/api/enroll/route.ts) (Enrollment API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_enrollment["Applicant Enrollment"]
  node_form["Enrollment Form<br/>[page.tsx]"]
  node_enroll_api["Enrollment API<br/>[route.ts]"]
end

subgraph group_admin["Admin Operations"]
  node_middleware["Admin Route Guard<br/>[middleware.ts]"]
  node_login["Admin Login<br/>[page.tsx]"]
  node_admin_actions["Admin Actions<br/>[actions.ts]"]
  node_dashboard["Enrollment Dashboard<br/>[page.tsx]"]
  node_csv["CSV Export<br/>[CsvButton.tsx]"]
  node_row_actions["Record Actions<br/>[RowActions.tsx]"]
end

subgraph group_data["Persistence"]
  node_enrollment_model["Enrollment Model<br/>[Enrollment.ts]"]
  node_db_connection["MongoDB Connection<br/>[mongodb.ts]"]
  node_mongodb[("MongoDB")]
end

node_applicant(("Applicant"))
node_admin_user(("Admin"))

node_applicant -->|"completes"| node_form
node_form -->|"posts enrollment"| node_enroll_api
node_enroll_api -->|"connects through"| node_db_connection
node_enroll_api -->|"creates record"| node_enrollment_model
node_db_connection -->|"connects to"| node_mongodb
node_admin_user -->|"submits password"| node_login
node_login -->|"authenticates via"| node_admin_actions
node_middleware -->|"redirects unauthenticated"| node_login
node_middleware -->|"redirects authenticated"| node_dashboard
node_dashboard -->|"connects through"| node_db_connection
node_dashboard -->|"queries records"| node_enrollment_model
node_dashboard -->|"passes enrollment data"| node_csv
node_dashboard -->|"renders per record"| node_row_actions
node_dashboard -->|"uses logout action"| node_admin_actions
node_row_actions -->|"requests deletion"| node_admin_actions
node_admin_actions -->|"connects through"| node_db_connection
node_admin_actions -->|"deletes record"| node_enrollment_model

click node_form "https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/page.tsx"
click node_enroll_api "https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/api/enroll/route.ts"
click node_middleware "https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/middleware.ts"
click node_login "https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/login/page.tsx"
click node_admin_actions "https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/actions.ts"
click node_dashboard "https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/page.tsx"
click node_csv "https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/CsvButton.tsx"
click node_row_actions "https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/RowActions.tsx"
click node_enrollment_model "https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/models/Enrollment.ts"
click node_db_connection "https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/lib/mongodb.ts"

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_form,node_enroll_api toneBlue
class node_middleware,node_login,node_admin_actions,node_dashboard,node_csv,node_row_actions toneAmber
class node_enrollment_model,node_db_connection,node_mongodb toneMint
class node_applicant,node_admin_user toneIndigo
```

## Components

### Applicant Enrollment

- [Enrollment Form](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/page.tsx): `app/page.tsx`
- [Enrollment API](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/api/enroll/route.ts): `app/api/enroll/route.ts`

### Admin Operations

- [Admin Route Guard](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/middleware.ts): `middleware.ts`
- [Admin Login](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/login/page.tsx): `app/admin/login/page.tsx`
- [Admin Actions](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/actions.ts): `app/admin/actions.ts`
- [Enrollment Dashboard](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [CSV Export](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/CsvButton.tsx): `app/admin/CsvButton.tsx`
- [Record Actions](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/app/admin/RowActions.tsx): `app/admin/RowActions.tsx`

### Persistence

- [Enrollment Model](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/models/Enrollment.ts): `models/Enrollment.ts`
- [MongoDB Connection](https://github.com/abdulrehmangulfaraz/english-learning-hub/blob/main/lib/mongodb.ts): `lib/mongodb.ts`
- **MongoDB**

### Other components

- **Applicant**
- **Admin**

## Connections

- Applicant → Enrollment Form: completes (evidence: `app/page.tsx`)
- Enrollment Form → Enrollment API: posts enrollment (evidence: `app/page.tsx`)
- Enrollment API → MongoDB Connection: connects through (evidence: `app/api/enroll/route.ts`)
- Enrollment API → Enrollment Model: creates record (evidence: `app/api/enroll/route.ts`)
- MongoDB Connection → MongoDB: connects to (evidence: `lib/mongodb.ts`)
- Admin → Admin Login: submits password (evidence: `app/admin/login/page.tsx`)
- Admin Login → Admin Actions: authenticates via (evidence: `app/admin/login/page.tsx`)
- Admin Route Guard → Admin Login: redirects unauthenticated (evidence: `middleware.ts`)
- Admin Route Guard → Enrollment Dashboard: redirects authenticated (evidence: `middleware.ts`)
- Enrollment Dashboard → MongoDB Connection: connects through (evidence: `app/admin/page.tsx`)
- Enrollment Dashboard → Enrollment Model: queries records (evidence: `app/admin/page.tsx`)
- Enrollment Dashboard → CSV Export: passes enrollment data (evidence: `app/admin/page.tsx`)
- Enrollment Dashboard → Record Actions: renders per record (evidence: `app/admin/page.tsx`)
- Enrollment Dashboard → Admin Actions: uses logout action (evidence: `app/admin/page.tsx`)
- Record Actions → Admin Actions: requests deletion (evidence: `app/admin/RowActions.tsx`)
- Admin Actions → MongoDB Connection: connects through (evidence: `app/admin/actions.ts`)
- Admin Actions → Enrollment Model: deletes record (evidence: `app/admin/actions.ts`)
