# riteshraj1064/examify architecture

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

- Interactive diagram: https://gitdiagram.com/riteshraj1064/examify
- Repository: https://github.com/riteshraj1064/examify

## Overview

This repository implements an educational platform: learners use its API to browse study content, take tests, ask doubts, and access support; administrators manage platform content and operations. Separate services handle subscriptions and notifications. The graph preserves the major documented-in-code feature areas and the payment-to-notification flow. Evidence is limited to the supplied excerpts and SOURCE INDEX; the API gateway’s routing behavior and several unsampled feature internals are therefore not inferred.

Main entry points: [`server/src/app.js`](https://github.com/riteshraj1064/examify/blob/main/server/src/app.js) (Platform API), [`server/src/middleware/authMiddleware.js`](https://github.com/riteshraj1064/examify/blob/main/server/src/middleware/authMiddleware.js) (Authentication), [`payment-server/src/controllers/paymentController.js`](https://github.com/riteshraj1064/examify/blob/main/payment-server/src/controllers/paymentController.js) (Payment API), [`payment-server/src/services/paymentNotificationService.js`](https://github.com/riteshraj1064/examify/blob/main/payment-server/src/services/paymentNotificationService.js) (Payment notifications)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["Platform API"]
  node_main_app["Platform API<br/>[app.js]"]
  node_auth["Authentication<br/>[authMiddleware.js]"]
  node_responses["API responses<br/>[apiResponse.js]"]
  node_api_gateway["API gateway<br/>[index.js]"]
  node_analytics["Analytics"]
  node_mongo[("MongoDB")]
end

subgraph group_learning["Learning"]
  node_content["Study content"]
  node_study_materials["Study materials"]
  node_daily_tests["Daily tests"]
  node_live_tests["Live tests"]
  node_test_attempts["Test attempts"]
end

subgraph group_community["Community &amp; Support"]
  node_doubts["Doubt discussions<br/>[doubtController.js]"]
  node_support["Support &amp; FAQs"]
  node_ai_doubts["AI doubt help"]
end

subgraph group_commerce["Payments"]
  node_payment_api["Payment API"]
  node_payment_routes["Payment routes<br/>[paymentRoutes.js]"]
  node_payment_models[("Payment records<br/>[Transaction.js]")]
  node_payment_notify["Payment notifications"]
end

subgraph group_notifications["Notifications"]
  node_mqtt["MQTT broker"]
  node_notification_server["Notification service<br/>[index.js]"]
  node_mqtt_dispatch["MQTT dispatch<br/>[mqttBroker.js]"]
  node_push["Push delivery<br/>[pushService.js]"]
  node_email["Email delivery<br/>[emailService.js]"]
  node_token_service["Token cleanup<br/>[tokenService.js]"]
end

node_learner(("Learner"))
node_admin(("Administrator"))

node_learner -->|"uses API"| node_main_app
node_admin -->|"uses API"| node_main_app
node_main_app -->|"authenticates"| node_auth
node_main_app -->|"routes content"| node_content
node_main_app -->|"routes materials"| node_study_materials
node_main_app -->|"routes daily tests"| node_daily_tests
node_main_app -->|"routes live tests"| node_live_tests
node_main_app -->|"routes attempts"| node_test_attempts
node_main_app -->|"routes doubts"| node_doubts
node_main_app -->|"routes support"| node_support
node_main_app -->|"routes AI help"| node_ai_doubts
node_main_app -->|"routes analytics"| node_analytics
node_auth -->|"returns errors"| node_responses
node_auth -->|"reads users"| node_mongo
node_doubts -->|"formats responses"| node_responses
node_support -->|"formats responses"| node_responses
node_payment_routes -->|"dispatches requests"| node_payment_api
node_payment_api -->|"records transactions"| node_payment_models
node_payment_api -->|"dispatches events"| node_payment_notify
node_payment_notify -->|"publishes messages"| node_mqtt
node_payment_notify -.->|"connects broker"| node_notification_server
node_notification_server -->|"starts broker handler"| node_mqtt_dispatch
node_mqtt_dispatch -->|"dispatches push"| node_push
node_mqtt_dispatch -->|"dispatches email"| node_email
node_push -->|"cleans invalid tokens"| node_token_service

click node_main_app "https://github.com/riteshraj1064/examify/blob/main/server/src/app.js"
click node_auth "https://github.com/riteshraj1064/examify/blob/main/server/src/middleware/authMiddleware.js"
click node_responses "https://github.com/riteshraj1064/examify/blob/main/server/src/utils/apiResponse.js"
click node_api_gateway "https://github.com/riteshraj1064/examify/blob/main/api-gateway/index.js"
click node_content "https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/questionController.js"
click node_study_materials "https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/studyMaterialController.js"
click node_daily_tests "https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/dailyTestController.js"
click node_live_tests "https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/liveTestController.js"
click node_test_attempts "https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/testAttemptController.js"
click node_doubts "https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/doubtController.js"
click node_support "https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/supportController.js"
click node_ai_doubts "https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/aiDoubtController.js"
click node_analytics "https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/analyticsController.js"
click node_payment_api "https://github.com/riteshraj1064/examify/blob/main/payment-server/src/controllers/paymentController.js"
click node_payment_routes "https://github.com/riteshraj1064/examify/blob/main/payment-server/src/routes/paymentRoutes.js"
click node_payment_models "https://github.com/riteshraj1064/examify/blob/main/payment-server/src/models/Transaction.js"
click node_payment_notify "https://github.com/riteshraj1064/examify/blob/main/payment-server/src/services/paymentNotificationService.js"
click node_notification_server "https://github.com/riteshraj1064/examify/blob/main/notification-server/index.js"
click node_mqtt_dispatch "https://github.com/riteshraj1064/examify/blob/main/notification-server/mqttBroker.js"
click node_push "https://github.com/riteshraj1064/examify/blob/main/notification-server/services/pushService.js"
click node_email "https://github.com/riteshraj1064/examify/blob/main/notification-server/services/emailService.js"
click node_token_service "https://github.com/riteshraj1064/examify/blob/main/notification-server/services/tokenService.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_main_app,node_auth,node_responses,node_api_gateway,node_analytics,node_mongo toneBlue
class node_content,node_study_materials,node_daily_tests,node_live_tests,node_test_attempts toneAmber
class node_doubts,node_support,node_ai_doubts toneMint
class node_payment_api,node_payment_routes,node_payment_models,node_payment_notify toneRose
class node_mqtt,node_notification_server,node_mqtt_dispatch,node_push,node_email,node_token_service,node_learner,node_admin toneIndigo
```

## Components

### Platform API

- [Platform API](https://github.com/riteshraj1064/examify/blob/main/server/src/app.js): `server/src/app.js`
- [Authentication](https://github.com/riteshraj1064/examify/blob/main/server/src/middleware/authMiddleware.js): `server/src/middleware/authMiddleware.js`
- [API responses](https://github.com/riteshraj1064/examify/blob/main/server/src/utils/apiResponse.js): `server/src/utils/apiResponse.js`
- [API gateway](https://github.com/riteshraj1064/examify/blob/main/api-gateway/index.js): `api-gateway/index.js`
- [Analytics](https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/analyticsController.js): `server/src/controllers/analyticsController.js`
- **MongoDB**

### Learning

- [Study content](https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/questionController.js): `server/src/controllers/questionController.js`
- [Study materials](https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/studyMaterialController.js): `server/src/controllers/studyMaterialController.js`
- [Daily tests](https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/dailyTestController.js): `server/src/controllers/dailyTestController.js`
- [Live tests](https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/liveTestController.js): `server/src/controllers/liveTestController.js`
- [Test attempts](https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/testAttemptController.js): `server/src/controllers/testAttemptController.js`

### Community & Support

- [Doubt discussions](https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/doubtController.js): `server/src/controllers/doubtController.js`
- [Support & FAQs](https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/supportController.js): `server/src/controllers/supportController.js`
- [AI doubt help](https://github.com/riteshraj1064/examify/blob/main/server/src/controllers/aiDoubtController.js): `server/src/controllers/aiDoubtController.js`

### Payments

- [Payment API](https://github.com/riteshraj1064/examify/blob/main/payment-server/src/controllers/paymentController.js): `payment-server/src/controllers/paymentController.js`
- [Payment routes](https://github.com/riteshraj1064/examify/blob/main/payment-server/src/routes/paymentRoutes.js): `payment-server/src/routes/paymentRoutes.js`
- [Payment records](https://github.com/riteshraj1064/examify/blob/main/payment-server/src/models/Transaction.js): `payment-server/src/models/Transaction.js`
- [Payment notifications](https://github.com/riteshraj1064/examify/blob/main/payment-server/src/services/paymentNotificationService.js): `payment-server/src/services/paymentNotificationService.js`

### Notifications

- **MQTT broker**
- [Notification service](https://github.com/riteshraj1064/examify/blob/main/notification-server/index.js): `notification-server/index.js`
- [MQTT dispatch](https://github.com/riteshraj1064/examify/blob/main/notification-server/mqttBroker.js): `notification-server/mqttBroker.js`
- [Push delivery](https://github.com/riteshraj1064/examify/blob/main/notification-server/services/pushService.js): `notification-server/services/pushService.js`
- [Email delivery](https://github.com/riteshraj1064/examify/blob/main/notification-server/services/emailService.js): `notification-server/services/emailService.js`
- [Token cleanup](https://github.com/riteshraj1064/examify/blob/main/notification-server/services/tokenService.js): `notification-server/services/tokenService.js`

### Other components

- **Learner**
- **Administrator**

## Connections

- Learner → Platform API: uses API (evidence: `server/src/app.js`)
- Administrator → Platform API: uses API (evidence: `server/src/app.js`)
- Platform API → Authentication: authenticates (evidence: `server/src/app.js`)
- Platform API → Study content: routes content (evidence: `server/src/app.js`)
- Platform API → Study materials: routes materials (evidence: `server/src/app.js`)
- Platform API → Daily tests: routes daily tests (evidence: `server/src/app.js`)
- Platform API → Live tests: routes live tests (evidence: `server/src/app.js`)
- Platform API → Test attempts: routes attempts (evidence: `server/src/app.js`)
- Platform API → Doubt discussions: routes doubts (evidence: `server/src/app.js`)
- Platform API → Support & FAQs: routes support (evidence: `server/src/app.js`)
- Platform API → AI doubt help: routes AI help (evidence: `server/src/app.js`)
- Platform API → Analytics: routes analytics (evidence: `server/src/app.js`)
- Authentication → API responses: returns errors (evidence: `server/src/middleware/authMiddleware.js`)
- Authentication → MongoDB: reads users (evidence: `server/src/middleware/authMiddleware.js`)
- Doubt discussions → API responses: formats responses (evidence: `server/src/controllers/doubtController.js`)
- Support & FAQs → API responses: formats responses (evidence: `server/src/controllers/supportController.js`)
- Payment routes → Payment API: dispatches requests (evidence: `payment-server/src/routes/paymentRoutes.js`)
- Payment API → Payment records: records transactions (evidence: `payment-server/src/controllers/paymentController.js`)
- Payment API → Payment notifications: dispatches events (evidence: `payment-server/src/controllers/paymentController.js`)
- Payment notifications → MQTT broker: publishes messages (evidence: `payment-server/src/services/paymentNotificationService.js`)
- Payment notifications → Notification service: connects broker
- Notification service → MQTT dispatch: starts broker handler (evidence: `notification-server/index.js`)
- MQTT dispatch → Push delivery: dispatches push (evidence: `notification-server/mqttBroker.js`)
- MQTT dispatch → Email delivery: dispatches email (evidence: `notification-server/mqttBroker.js`)
- Push delivery → Token cleanup: cleans invalid tokens (evidence: `notification-server/services/pushService.js`)
