# amitbedprakashpandey/-brainplaybackend architecture

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

- Interactive diagram: https://gitdiagram.com/amitbedprakashpandey/-brainplaybackend
- Repository: https://github.com/amitbedprakashpandey/-brainplaybackend

## Overview

This is an Express/Mongoose API for an interschool olympiad and sports platform. Clients enter through the server’s mounted API routes; handlers manage registration, exams, events, schools, payments, news, enquiries, sports, test rooms, authentication, and file/mail operations. The clearest end-to-end workflow is participant registration: persist the participant, render an invoice, create a PDF, and email it. The README is empty, so capability coverage comes from the route inventory and sampled files; several unsampled controller-to-model relationships are intentionally omitted.

Main entry points: [`index.js`](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/index.js) (Express server), [`controllers/participantController.js`](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/participantController.js) (Participant management), [`controllers/AuthController.js`](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/AuthController.js) (Authentication), [`controllers/mailController.js`](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/mailController.js) (Receipt mail)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_server["Express server<br/>[index.js]"]
  node_participant_routes["Participant routes"]
  node_exam_routes["Exam routes<br/>[examRoutes.js]"]
  node_events_routes["Event routes<br/>[EventsRoutes.js]"]
  node_school_routes["School routes<br/>[schoolRoutes.js]"]
  node_post_routes["News routes<br/>[postRoutes.js]"]
  node_enquiry_routes["Enquiry routes<br/>[EnquiryRoutes.js]"]
  node_sports_routes["Live sports routes"]
  node_testroom_routes["Test room routes<br/>[TestRoomRouter.js]"]
  node_auth_routes["Auth routes<br/>[AuthRouter.js]"]
  node_payment_routes["Payment routes<br/>[paymentRoutes.js]"]
  node_order_routes["Order routes<br/>[orderRoutes.js]"]
end

subgraph group_programs["Programs and content"]
  node_exam_handler["Exam management<br/>[examController.js]"]
  node_exam_store[("Exam records<br/>[Exam.js]")]
  node_event_handler["Event management<br/>[EventController.js]"]
  node_school_handler["School management"]
  node_post_handler["News management<br/>[postController.js]"]
  node_post_store[("News records<br/>[Post.js]")]
  node_enquiry_handler["Enquiry handling"]
  node_sports_handler["Live sports"]
  node_testroom_handler["Test room management"]
end

subgraph group_registration["Registration and mail"]
  node_participant_handler["Participant management"]
  node_participant_store[("Participant records<br/>[Participant.js]")]
  node_mail_handler["Receipt mail<br/>[mailController.js]"]
  node_invoice["Invoice rendering<br/>[invoiceTemplate.js]"]
  node_receipt_store[("Mail receipts<br/>[FeesSendMail.js]")]
end

subgraph group_identity["Identity and access"]
  node_auth_handler["Authentication<br/>[AuthController.js]"]
  node_user_store[("User records<br/>[UserModel.js]")]
  node_otp_store[("OTP records<br/>[Otp.js]")]
  node_token_store[("Revoked tokens")]
  node_auth_middleware["Token verification<br/>[authMiddleware.js]"]
end

subgraph group_transactions["Payments and files"]
  node_payment_handler["Payment handling"]
  node_payment_store[("Payment records<br/>[Payment.js]")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_server
node_server -->|"mounts routes"| node_participant_routes
node_server -->|"mounts routes"| node_exam_routes
node_server -->|"mounts routes"| node_events_routes
node_server -->|"mounts routes"| node_school_routes
node_server -->|"mounts routes"| node_post_routes
node_server -->|"mounts routes"| node_enquiry_routes
node_server -->|"mounts routes"| node_sports_routes
node_server -->|"mounts routes"| node_testroom_routes
node_server -->|"mounts routes"| node_auth_routes
node_server -->|"mounts routes"| node_payment_routes
node_server -->|"mounts routes"| node_order_routes
node_participant_routes -->|"dispatches to"| node_participant_handler
node_exam_routes -->|"dispatches to"| node_exam_handler
node_events_routes -->|"dispatches to"| node_event_handler
node_school_routes -->|"dispatches to"| node_school_handler
node_post_routes -->|"dispatches to"| node_post_handler
node_enquiry_routes -->|"dispatches to"| node_enquiry_handler
node_sports_routes -->|"dispatches to"| node_sports_handler
node_testroom_routes -->|"dispatches to"| node_testroom_handler
node_auth_routes -->|"dispatches to"| node_auth_handler
node_payment_routes -->|"dispatches to"| node_payment_handler
node_participant_handler -->|"creates and queries"| node_participant_store
node_participant_handler -->|"renders invoice"| node_invoice
node_participant_handler -->|"sends receipt"| node_mail_handler
node_participant_handler -->|"records delivery"| node_receipt_store
node_mail_handler -->|"renders invoice"| node_invoice
node_mail_handler -->|"loads participant"| node_participant_store
node_mail_handler -->|"reads and writes"| node_receipt_store
node_exam_handler -->|"reads and writes"| node_exam_store
node_post_handler -->|"reads and writes"| node_post_store
node_auth_handler -->|"reads and writes"| node_user_store
node_auth_handler -->|"manages reset OTPs"| node_otp_store
node_auth_handler -->|"blacklists token"| node_token_store
node_auth_middleware -->|"checks revocation"| node_token_store
node_auth_handler -.->|"expects verified token"| node_auth_middleware
node_payment_handler -->|"uses payment records"| node_payment_store

click node_server "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/index.js"
click node_participant_routes "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/participantRoutes.js"
click node_exam_routes "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/examRoutes.js"
click node_events_routes "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/EventsRoutes.js"
click node_school_routes "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/schoolRoutes.js"
click node_post_routes "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/postRoutes.js"
click node_enquiry_routes "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/EnquiryRoutes.js"
click node_sports_routes "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/LiveSportsRouter.js"
click node_testroom_routes "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/TestRoomRouter.js"
click node_participant_handler "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/participantController.js"
click node_participant_store "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/Participant.js"
click node_mail_handler "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/mailController.js"
click node_invoice "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/Template/invoiceTemplate.js"
click node_receipt_store "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/FeesSendMail.js"
click node_exam_handler "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/examController.js"
click node_exam_store "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/Exam.js"
click node_event_handler "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/EventController.js"
click node_school_handler "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/schoolController.js"
click node_post_handler "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/postController.js"
click node_post_store "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/Post.js"
click node_enquiry_handler "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/EnquiryController.js"
click node_sports_handler "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/LiveSportsController.js"
click node_testroom_handler "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/TestRoomController.js"
click node_auth_routes "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/AuthRouter.js"
click node_auth_handler "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/AuthController.js"
click node_user_store "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/UserModel.js"
click node_otp_store "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/Otp.js"
click node_token_store "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/BlacklistedToken.js"
click node_auth_middleware "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/MildelwarController/authMiddleware.js"
click node_payment_routes "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/paymentRoutes.js"
click node_payment_handler "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/paymentController.js"
click node_payment_store "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/Payment.js"
click node_order_routes "https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/orderRoutes.js"

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_server,node_participant_routes,node_exam_routes,node_events_routes,node_school_routes,node_post_routes,node_enquiry_routes,node_sports_routes,node_testroom_routes,node_auth_routes,node_payment_routes,node_order_routes,node_client toneBlue
class node_exam_handler,node_exam_store,node_event_handler,node_school_handler,node_post_handler,node_post_store,node_enquiry_handler,node_sports_handler,node_testroom_handler toneAmber
class node_participant_handler,node_participant_store,node_mail_handler,node_invoice,node_receipt_store toneMint
class node_auth_handler,node_user_store,node_otp_store,node_token_store,node_auth_middleware toneRose
class node_payment_handler,node_payment_store toneIndigo
```

## Components

### API entry

- [Express server](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/index.js): `index.js`
- [Participant routes](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/participantRoutes.js): `routes/participantRoutes.js`
- [Exam routes](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/examRoutes.js): `routes/examRoutes.js`
- [Event routes](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/EventsRoutes.js): `routes/EventsRoutes.js`
- [School routes](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/schoolRoutes.js): `routes/schoolRoutes.js`
- [News routes](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/postRoutes.js): `routes/postRoutes.js`
- [Enquiry routes](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/EnquiryRoutes.js): `routes/EnquiryRoutes.js`
- [Live sports routes](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/LiveSportsRouter.js): `routes/LiveSportsRouter.js`
- [Test room routes](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/TestRoomRouter.js): `routes/TestRoomRouter.js`
- [Auth routes](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/AuthRouter.js): `routes/AuthRouter.js`
- [Payment routes](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/paymentRoutes.js): `routes/paymentRoutes.js`
- [Order routes](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/routes/orderRoutes.js): `routes/orderRoutes.js`

### Programs and content

- [Exam management](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/examController.js): `controllers/examController.js`
- [Exam records](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/Exam.js): `Model/Exam.js`
- [Event management](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/EventController.js): `controllers/EventController.js`
- [School management](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/schoolController.js): `controllers/schoolController.js`
- [News management](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/postController.js): `controllers/postController.js`
- [News records](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/Post.js): `Model/Post.js`
- [Enquiry handling](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/EnquiryController.js): `controllers/EnquiryController.js`
- [Live sports](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/LiveSportsController.js): `controllers/LiveSportsController.js`
- [Test room management](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/TestRoomController.js): `controllers/TestRoomController.js`

### Registration and mail

- [Participant management](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/participantController.js): `controllers/participantController.js`
- [Participant records](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/Participant.js): `Model/Participant.js`
- [Receipt mail](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/mailController.js): `controllers/mailController.js`
- [Invoice rendering](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/Template/invoiceTemplate.js): `controllers/Template/invoiceTemplate.js`
- [Mail receipts](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/FeesSendMail.js): `Model/FeesSendMail.js`

### Identity and access

- [Authentication](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/AuthController.js): `controllers/AuthController.js`
- [User records](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/UserModel.js): `Model/UserModel.js`
- [OTP records](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/Otp.js): `Model/Otp.js`
- [Revoked tokens](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/BlacklistedToken.js): `Model/BlacklistedToken.js`
- [Token verification](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/MildelwarController/authMiddleware.js): `controllers/MildelwarController/authMiddleware.js`

### Payments and files

- [Payment handling](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/controllers/paymentController.js): `controllers/paymentController.js`
- [Payment records](https://github.com/amitbedprakashpandey/-brainplaybackend/blob/main/Model/Payment.js): `Model/Payment.js`

### Other components

- **API client**

## Connections

- API client → Express server: sends requests (evidence: `index.js`)
- Express server → Participant routes: mounts routes (evidence: `index.js`)
- Express server → Exam routes: mounts routes (evidence: `index.js`)
- Express server → Event routes: mounts routes (evidence: `index.js`)
- Express server → School routes: mounts routes (evidence: `index.js`)
- Express server → News routes: mounts routes (evidence: `index.js`)
- Express server → Enquiry routes: mounts routes (evidence: `index.js`)
- Express server → Live sports routes: mounts routes (evidence: `index.js`)
- Express server → Test room routes: mounts routes (evidence: `index.js`)
- Express server → Auth routes: mounts routes (evidence: `index.js`)
- Express server → Payment routes: mounts routes (evidence: `index.js`)
- Express server → Order routes: mounts routes (evidence: `index.js`)
- Participant routes → Participant management: dispatches to (evidence: `routes/participantRoutes.js`)
- Exam routes → Exam management: dispatches to (evidence: `routes/examRoutes.js`)
- Event routes → Event management: dispatches to (evidence: `routes/EventsRoutes.js`)
- School routes → School management: dispatches to (evidence: `routes/schoolRoutes.js`)
- News routes → News management: dispatches to (evidence: `routes/postRoutes.js`)
- Enquiry routes → Enquiry handling: dispatches to (evidence: `routes/EnquiryRoutes.js`)
- Live sports routes → Live sports: dispatches to (evidence: `routes/LiveSportsRouter.js`)
- Test room routes → Test room management: dispatches to (evidence: `routes/TestRoomRouter.js`)
- Auth routes → Authentication: dispatches to (evidence: `routes/AuthRouter.js`)
- Payment routes → Payment handling: dispatches to (evidence: `routes/paymentRoutes.js`)
- Participant management → Participant records: creates and queries (evidence: `controllers/participantController.js`)
- Participant management → Invoice rendering: renders invoice (evidence: `controllers/participantController.js`)
- Participant management → Receipt mail: sends receipt (evidence: `controllers/participantController.js`)
- Participant management → Mail receipts: records delivery (evidence: `controllers/participantController.js`)
- Receipt mail → Invoice rendering: renders invoice (evidence: `controllers/mailController.js`)
- Receipt mail → Participant records: loads participant (evidence: `controllers/mailController.js`)
- Receipt mail → Mail receipts: reads and writes (evidence: `controllers/mailController.js`)
- Exam management → Exam records: reads and writes (evidence: `controllers/examController.js`)
- News management → News records: reads and writes (evidence: `controllers/postController.js`)
- Authentication → User records: reads and writes (evidence: `controllers/AuthController.js`)
- Authentication → OTP records: manages reset OTPs (evidence: `controllers/AuthController.js`)
- Authentication → Revoked tokens: blacklists token (evidence: `controllers/AuthController.js`)
- Token verification → Revoked tokens: checks revocation (evidence: `controllers/MildelwarController/authMiddleware.js`)
- Authentication → Token verification: expects verified token
- Payment handling → Payment records: uses payment records (evidence: `controllers/paymentController.js`)
