# aryan9855/curaconnect architecture

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

- Interactive diagram: https://gitdiagram.com/aryan9855/curaconnect
- Repository: https://github.com/aryan9855/curaconnect

## Overview

1. **Repository shape**
   - This is a two-app monorepo: `Server/` is the backend API and `curaConnect/` is the React frontend.
   - The system is a classic client/API split with the frontend consuming REST endpoints from the backend.

2. **Frontend boundary**
   - The UI is built with **React + Vite**, styled with **Tailwind CSS**, and state-managed with **Redux Toolkit**.
   - Routing is handled in the frontend with page-level views such as Home, About, Catalog, Login/Signup, Dashboard, and Health Program detail/playback pages.

3. **Frontend feature organization**
   - The `src/components/core` tree is organized by product area: Home page, Auth, Catalog, Dashboard, View Health Program, and About.
   - Dashboard functionality is further subdivided into doctor/admin-like flows: creating health programs, editing them, managing enrolled users, cart/payment flow, settings, and profile management.

4. **Frontend data layer**
   - API calls are centralized under `src/services`, with `apiconnector.js`, endpoint definitions, and operation modules grouped by domain.
   - Redux slices (`authSlice`, `cartSlice`, `healthProgramSlice`, `profileSlice`, `viewHealthProgramSlice`) hold the app’s cross-page state, especially auth, enrollment/cart, profile, and active learning/viewing state.

5. **Backend architecture**
   - The server is a **Node.js + Express** application following an MVC-style structure.
   - Request handling is split into `routes/`, `controllers/`, `middlewares/`, `models/`, and `utils/`, with `Server/index.js` acting as the API bootstrap.

6. **Backend domain model**
   - MongoDB models represent the main business entities: `User`, `Profile`, `OTP`, `Category`, `HealthProgram`, `Section`, `SubSection`, `HealthProgramProgress`, and `RatingAndReview`.
   - This implies a structured content hierarchy: health programs contain sections and subsections, and users progress through them while leaving ratings/reviews.

7. **Authentication and authorization**
   - Authentication is JWT-based, with auth middleware protecting sensitive routes.
   - The presence of profile, password reset, OTP, and email verification models/templates suggests a full account lifecycle: signup, verification, login, profile edits, password reset, and account deletion.

8. **Program delivery and enrollment flow**
   - Users browse health programs, inspect details, enroll, and later view lesson/video content.
   - The backend tracks enrollment/progress and sends transactional emails such as verification, enrollment confirmation, payment success, and password updates.

9. **Payments and media services**
   - Payments are integrated through **Razorpay**, likely for program enrollment checkout and server-side payment verification.
   - Media uploads use **Cloudinary**, which is important for program assets such as thumbnails or other uploaded content.

10. **Communication and notifications**
   - Email delivery is abstracted through `utils/mailSender.js` plus HTML templates in `Server/mail/templates`.
   - This forms a separate notification boundary from the core API, used for user-facing events like verification, enrollment, and password changes.

11. **Key route groups**
   - Backend routes are grouped by business area: `User`, `Profile`, `HealthProgram`, `Payments`, and `Contact`.
   - The controllers mirror these route groups, which makes the API split align closely with the domain model.

12. **End-to-end data flow**
   - Typical flow: React page → service module → REST API → controller → MongoDB model/external service → response back to Redux/UI.
   - For enrollment/payment flows, the path additionally involves Razorpay verification and email notifications; for media upload flows, Cloudinary sits on the server side before persistence.

13. **Deployment and runtime split**
   - The README indicates separate production deployments for frontend and backend, both hosted on Vercel.
   - That means the frontend and API are independently deployable/runtime-separated, even though they form one logical application.

14. **What to show in an architecture diagram**
   - Draw two major boxes: frontend SPA and backend API.
   - Inside the backend, emphasize controllers, models, auth middleware, email, Razorpay, and Cloudinary.
   - Inside the frontend, emphasize routed pages, dashboard modules, Redux state, and API service layer.
   - Connect them through REST calls and show MongoDB as the persistent store plus Razorpay/Cloudinary as external integrations.

Main entry points: [`Server/controllers/Auth.js`](https://github.com/aryan9855/curaconnect/blob/main/Server/controllers/Auth.js) (Controllers), [`curaConnect/src/services/apiconnector.js`](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/services/apiconnector.js) (API services), [`curaConnect/src/reducer/index.js`](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/reducer/index.js) (Redux store), [`Server/routes/User.js`](https://github.com/aryan9855/curaconnect/blob/main/Server/routes/User.js) (Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["curaConnect SPA"]
  node_home_pages["Marketing pages<br/>react pages<br/>[Home.jsx]"]
  node_dashboard_pages["Dashboard pages<br/>react pages<br/>[Dashboard.jsx]"]
  node_learning_pages["Learning views<br/>react pages"]
  node_auth_components["Auth UI<br/>ui components<br/>[LoginForm.jsx]"]
  node_home_components["Home UI<br/>ui components<br/>[Navbar.jsx]"]
  node_catalog_ui["Catalog UI<br/>ui components"]
  node_dashboard_ui["Dashboard modules<br/>ui components<br/>[index.jsx]"]
  node_learning_ui["Player UI<br/>ui components<br/>[VideoDetails.jsx]"]
  node_api_service_layer["API services<br/>client api<br/>[apiconnector.js]"]
  node_redux_store["Redux store<br/>state store<br/>[index.js]"]
  node_frontend_auth_state["Auth state<br/>redux slice<br/>[authSlice.js]"]
  node_frontend_learning_state["Learning state<br/>redux slice<br/>[cartSlice.js]"]
end

subgraph group_backend["Server API"]
  node_server_bootstrap["API bootstrap<br/>express app<br/>[index.js]"]
  node_route_layer["Routes<br/>[User.js]"]
  node_controller_layer["Controllers<br/>[Auth.js]"]
  node_auth_middleware["Auth middleware<br/>jwt guard<br/>[auth.js]"]
  node_domain_models[("Domain models<br/>mongoose models<br/>[User.js]")]
  node_mail_system["Mail system<br/>notification service<br/>[mailSender.js]"]
  node_media_payments["Media & payments<br/>external integrations<br/>[razorpay.js]"]
end

subgraph group_external["External systems"]
  node_database[("MongoDB<br/>persistent store")]
end

node_home_pages -->|"fetches data"| node_api_service_layer
node_dashboard_pages -->|"mutates data"| node_api_service_layer
node_learning_pages -->|"loads playback"| node_api_service_layer
node_api_service_layer -->|"dispatches"| node_redux_store
node_redux_store -->|"includes"| node_frontend_auth_state
node_redux_store -->|"includes"| node_frontend_learning_state
node_auth_components -->|"reads/writes"| node_frontend_auth_state
node_dashboard_ui -->|"reads/writes"| node_frontend_learning_state
node_home_components -->|"renders"| node_home_pages
node_catalog_ui -->|"renders"| node_home_pages
node_learning_ui -->|"renders"| node_learning_pages
node_server_bootstrap -->|"mounts"| node_route_layer
node_route_layer -->|"delegates"| node_controller_layer
node_controller_layer -->|"protects"| node_auth_middleware
node_controller_layer -->|"queries"| node_domain_models
node_controller_layer -->|"sends mail"| node_mail_system
node_controller_layer -->|"uses"| node_media_payments
node_domain_models -->|"persists"| node_database
node_controller_layer -->|"reads/writes"| node_database
node_api_service_layer -->|"REST calls"| node_server_bootstrap
node_route_layer -->|"applies"| node_auth_middleware
node_media_payments -->|"confirms state"| node_database

click node_home_pages "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/pages/Home.jsx"
click node_dashboard_pages "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/pages/Dashboard.jsx"
click node_learning_pages "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/pages/ViewHealthProgram.jsx"
click node_auth_components "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/components/core/Auth/LoginForm.jsx"
click node_home_components "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/components/core/HomePage/common/Navbar.jsx"
click node_catalog_ui "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/components/core/Catalog/HealthProgramSlider.jsx"
click node_dashboard_ui "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/components/core/Dashboard/AddHealthProgram/index.jsx"
click node_learning_ui "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/components/core/ViewHealthProgram/VideoDetails.jsx"
click node_api_service_layer "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/services/apiconnector.js"
click node_redux_store "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/reducer/index.js"
click node_frontend_auth_state "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/slices/authSlice.js"
click node_frontend_learning_state "https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/slices/cartSlice.js"
click node_server_bootstrap "https://github.com/aryan9855/curaconnect/blob/main/Server/index.js"
click node_route_layer "https://github.com/aryan9855/curaconnect/blob/main/Server/routes/User.js"
click node_controller_layer "https://github.com/aryan9855/curaconnect/blob/main/Server/controllers/Auth.js"
click node_auth_middleware "https://github.com/aryan9855/curaconnect/blob/main/Server/middlewares/auth.js"
click node_domain_models "https://github.com/aryan9855/curaconnect/blob/main/Server/models/User.js"
click node_mail_system "https://github.com/aryan9855/curaconnect/blob/main/Server/utils/mailSender.js"
click node_media_payments "https://github.com/aryan9855/curaconnect/blob/main/Server/config/razorpay.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_home_pages,node_dashboard_pages,node_learning_pages,node_auth_components,node_home_components,node_catalog_ui,node_dashboard_ui,node_learning_ui,node_api_service_layer,node_redux_store,node_frontend_auth_state,node_frontend_learning_state toneBlue
class node_server_bootstrap,node_route_layer,node_controller_layer,node_auth_middleware,node_domain_models,node_mail_system,node_media_payments toneAmber
class node_database toneMint
```

## Components

### curaConnect SPA

React frontend with routed pages, shared components, Redux state, and API services.

- [Marketing pages](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/pages/Home.jsx): react pages · Home, About, Catalog, and auth entry pages that drive public navigation. · `curaConnect/src/pages/Home.jsx`
- [Dashboard pages](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/pages/Dashboard.jsx): react pages · Authenticated views for doctor/admin workflows, settings, profile, cart, and program management. · `curaConnect/src/pages/Dashboard.jsx`
- [Learning views](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/pages/ViewHealthProgram.jsx): react pages · Program detail and playback screens for enrolled health program content. · `curaConnect/src/pages/ViewHealthProgram.jsx`
- [Auth UI](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/components/core/Auth/LoginForm.jsx): ui components · Login/signup forms, route guards, dropdowns, and auth templates. · `curaConnect/src/components/core/Auth/LoginForm.jsx`
- [Home UI](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/components/core/HomePage/common/Navbar.jsx): ui components · Landing-page sections, shared navigation/footer, and review/CTA widgets. · `curaConnect/src/components/core/HomePage/common/Navbar.jsx`
- [Catalog UI](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/components/core/Catalog/HealthProgramSlider.jsx): ui components · Program browsing widgets and listing cards/sliders. · `curaConnect/src/components/core/Catalog/HealthProgramSlider.jsx`
- [Dashboard modules](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/components/core/Dashboard/AddHealthProgram/index.jsx): ui components · Program builder, editing, enrolled programs, doctor views, cart, and settings flows. · `curaConnect/src/components/core/Dashboard/AddHealthProgram/index.jsx`
- [Player UI](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/components/core/ViewHealthProgram/VideoDetails.jsx): ui components · Video details, sidebar navigation, auto-redirect, and review modal for learning flows. · `curaConnect/src/components/core/ViewHealthProgram/VideoDetails.jsx`
- [API services](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/services/apiconnector.js): client api · Centralized REST connector, endpoint catalog, and domain operation modules. · `curaConnect/src/services/apiconnector.js`
- [Redux store](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/reducer/index.js): state store · App-wide client state composed from feature slices. · `curaConnect/src/reducer/index.js`
- [Auth state](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/slices/authSlice.js): redux slice · Session, identity, and authentication state. · `curaConnect/src/slices/authSlice.js`
- [Learning state](https://github.com/aryan9855/curaconnect/blob/main/curaConnect/src/slices/cartSlice.js): redux slice · Cart, enrolled program, profile, and active viewing state. · `curaConnect/src/slices/cartSlice.js`

### Server API

Express backend with routes, controllers, models, middleware, and service integrations.

- [API bootstrap](https://github.com/aryan9855/curaconnect/blob/main/Server/index.js): express app · Server entry point that wires the Express application and runtime configuration. · `Server/index.js`
- [Routes](https://github.com/aryan9855/curaconnect/blob/main/Server/routes/User.js): express routes · Business-route grouping for user, profile, program, payments, and contact APIs. · `Server/routes/User.js`
- [Controllers](https://github.com/aryan9855/curaconnect/blob/main/Server/controllers/Auth.js): mvc controllers · Request handlers for auth, profiles, health programs, progress, payments, ratings, sections, and contact. · `Server/controllers/Auth.js`
- [Auth middleware](https://github.com/aryan9855/curaconnect/blob/main/Server/middlewares/auth.js): jwt guard · JWT protection for sensitive API routes. · `Server/middlewares/auth.js`
- [Domain models](https://github.com/aryan9855/curaconnect/blob/main/Server/models/User.js): mongoose models · User, profile, OTP, category, program hierarchy, progress, and reviews. · `Server/models/User.js`
- [Mail system](https://github.com/aryan9855/curaconnect/blob/main/Server/utils/mailSender.js): notification service · Email sender and HTML templates for verification, enrollment, payment, and password updates. · `Server/utils/mailSender.js`
- [Media & payments](https://github.com/aryan9855/curaconnect/blob/main/Server/config/razorpay.js): external integrations · Cloudinary upload support and Razorpay payment configuration/verification. · `Server/config/razorpay.js`

### External systems

Persistent store and third-party services used by the application.

- **MongoDB**: persistent store · Primary database backing users, profiles, programs, progress, and reviews.

## Connections

- Marketing pages → API services: fetches data · Public pages load catalog, auth, and content data through the client API layer.
- Dashboard pages → API services: mutates data · Dashboard workflows create, edit, enroll, and update records through service modules.
- Learning views → API services: loads playback · Program detail and playback views request content and progress state.
- API services → Redux store: dispatches · Service operations update shared client state after API responses.
- Redux store → Auth state: includes · Store composition includes auth state.
- Redux store → Learning state: includes · Store composition includes cart, profile, and viewing state.
- Auth UI → Auth state: reads/writes · Login and signup flows use auth state and route guards.
- Dashboard modules → Learning state: reads/writes · Program management and enrollment flows use shared learning-related state.
- Home UI → Marketing pages: renders · Shared landing-page components assemble the public pages.
- Catalog UI → Marketing pages: renders · Catalog widgets power the browsing page.
- Player UI → Learning views: renders · Player components assemble the content viewing pages.
- API bootstrap → Routes: mounts · The server entry point wires route groups into the Express app.
- Routes → Controllers: delegates · Routes forward requests to domain controllers.
- Controllers → Auth middleware: protects · Sensitive endpoints rely on JWT middleware.
- Controllers → Domain models: queries · Controllers read and write business entities through models.
- Controllers → Mail system: sends mail · Account, enrollment, and payment events trigger transactional email.
- Controllers → Media & payments: uses · Uploads and payment flows depend on external media/payment services.
- Domain models → MongoDB: persists · Mongoose models store application data in MongoDB.
- Controllers → MongoDB: reads/writes · Controllers ultimately persist and retrieve application data.
- API services → API bootstrap: REST calls · Frontend services call the backend API over REST.
- Routes → Auth middleware: applies · Protected routes are guarded before controller execution.
- Media & payments → MongoDB: confirms state · Payment and upload workflows complete before records are stored or updated.
