# bharatkhandelwal0/profilex architecture

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

- Interactive diagram: https://gitdiagram.com/bharatkhandelwal0/profilex
- Repository: https://github.com/bharatkhandelwal0/profilex

## Overview

MERN Profile App supports a user journey from landing page through registration or login to a protected profile, plus OTP-based password recovery. The React UI calls an Express API that routes requests to authentication, registration, profile, and recovery handlers; user records are modeled in MongoDB, and registration uploads profile images to Cloudinary. README documents several backend capabilities whose controller implementations were not excerpted, so those relationships are shown only where documented.

Main entry points: [`Backend/src/routes/user.route.js`](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/routes/user.route.js) (User routes), [`Frontend/src/App.jsx`](https://github.com/bharatkhandelwal0/profilex/blob/master/Frontend/src/App.jsx) (Route app), [`Backend/src/model/model.js`](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/model/model.js) (User model), [`Backend/src/controllers/userRegister.js`](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/userRegister.js) (User registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["React experience"]
  node_app["Route app<br/>[App.jsx]"]
  node_home["Landing page<br/>[Home.jsx]"]
  node_registration["Registration form"]
  node_login["Login form<br/>[LoginPage.jsx]"]
  node_recovery["OTP recovery screens"]
  node_guard["Protected route<br/>[ProtectedRoute.jsx]"]
  node_profile["Profile dashboard<br/>[Main.jsx]"]
end

subgraph group_api["Express API"]
  node_express["Express app<br/>[app.js]"]
  node_routes["User routes<br/>[user.route.js]"]
  node_bootstrap["Server bootstrap<br/>[index.js]"]
end

subgraph group_identity["Identity and profiles"]
  node_auth["Login and tokens<br/>[controller.js]"]
  node_register["User registration<br/>[userRegister.js]"]
  node_profilehandlers["Profile handlers<br/>[dashboard.js]"]
  node_recoveryhandlers["Password recovery<br/>[forgetPassword.js]"]
  node_passwordupdate["Password update<br/>[updatePassword.js]"]
  node_sessioncheck["Session check<br/>[user.check.js]"]
  node_middleware["JWT middleware<br/>[auth.Middleware.js]"]
end

subgraph group_services["Persistence and media"]
  node_userstore[("User model<br/>[model.js]")]
  node_mongo[("MongoDB")]
  node_upload["Upload handling"]
  node_cloudinary["Cloudinary upload<br/>[cloudinary.js]"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_registration
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_recovery
node_app -->|"protects"| node_guard
node_app -->|"routes to"| node_profile
node_login -->|"POST login"| node_routes
node_registration -->|"POST register"| node_routes
node_recovery -->|"requests OTP flow"| node_routes
node_guard -->|"checks session"| node_routes
node_profile -->|"GET dashboard"| node_routes
node_bootstrap -->|"starts"| node_express
node_bootstrap -->|"connects"| node_mongo
node_express -->|"mounts"| node_routes
node_routes -->|"dispatches login"| node_auth
node_routes -->|"dispatches registration"| node_register
node_routes -->|"dispatches dashboard"| node_profilehandlers
node_routes -->|"dispatches OTP"| node_recoveryhandlers
node_routes -->|"dispatches update"| node_passwordupdate
node_routes -->|"dispatches check"| node_sessioncheck
node_routes -->|"guards routes"| node_middleware
node_middleware -->|"verifies access"| node_sessioncheck
node_auth -->|"reads and saves"| node_userstore
node_register -->|"creates user"| node_userstore
node_profilehandlers -->|"reads profile"| node_userstore
node_recoveryhandlers -->|"stores OTP"| node_userstore
node_passwordupdate -->|"updates password"| node_userstore
node_userstore -->|"persists records"| node_mongo
node_routes -->|"uses image upload"| node_upload
node_register -->|"uploads image"| node_cloudinary
node_upload -.->|"stages file for"| node_cloudinary

click node_app "https://github.com/bharatkhandelwal0/profilex/blob/master/Frontend/src/App.jsx"
click node_home "https://github.com/bharatkhandelwal0/profilex/blob/master/Frontend/src/components/home/Home.jsx"
click node_registration "https://github.com/bharatkhandelwal0/profilex/tree/master/Frontend/src/components/register"
click node_login "https://github.com/bharatkhandelwal0/profilex/blob/master/Frontend/src/components/login/LoginPage.jsx"
click node_recovery "https://github.com/bharatkhandelwal0/profilex/tree/master/Frontend/src/components/login"
click node_guard "https://github.com/bharatkhandelwal0/profilex/blob/master/Frontend/src/components/verification/ProtectedRoute.jsx"
click node_profile "https://github.com/bharatkhandelwal0/profilex/blob/master/Frontend/src/components/profile/Main.jsx"
click node_express "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/app.js"
click node_routes "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/routes/user.route.js"
click node_bootstrap "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/index.js"
click node_auth "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/controller.js"
click node_register "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/userRegister.js"
click node_profilehandlers "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/dashboard.js"
click node_recoveryhandlers "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/forgetPassword.js"
click node_passwordupdate "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/updatePassword.js"
click node_sessioncheck "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/user.check.js"
click node_middleware "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/middleware/auth.Middleware.js"
click node_userstore "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/model/model.js"
click node_upload "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/middleware/multer.Middleware.js"
click node_cloudinary "https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/utils/cloudinary.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_app,node_home,node_registration,node_login,node_recovery,node_guard,node_profile toneBlue
class node_express,node_routes,node_bootstrap toneAmber
class node_auth,node_register,node_profilehandlers,node_recoveryhandlers,node_passwordupdate,node_sessioncheck,node_middleware toneMint
class node_userstore,node_mongo,node_upload,node_cloudinary toneRose
class node_visitor toneIndigo
```

## Components

### React experience

- [Route app](https://github.com/bharatkhandelwal0/profilex/blob/master/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [Landing page](https://github.com/bharatkhandelwal0/profilex/blob/master/Frontend/src/components/home/Home.jsx): `Frontend/src/components/home/Home.jsx`
- [Registration form](https://github.com/bharatkhandelwal0/profilex/tree/master/Frontend/src/components/register): `Frontend/src/components/register`
- [Login form](https://github.com/bharatkhandelwal0/profilex/blob/master/Frontend/src/components/login/LoginPage.jsx): `Frontend/src/components/login/LoginPage.jsx`
- [OTP recovery screens](https://github.com/bharatkhandelwal0/profilex/tree/master/Frontend/src/components/login): `Frontend/src/components/login`
- [Protected route](https://github.com/bharatkhandelwal0/profilex/blob/master/Frontend/src/components/verification/ProtectedRoute.jsx): `Frontend/src/components/verification/ProtectedRoute.jsx`
- [Profile dashboard](https://github.com/bharatkhandelwal0/profilex/blob/master/Frontend/src/components/profile/Main.jsx): `Frontend/src/components/profile/Main.jsx`

### Express API

- [Express app](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/app.js): `Backend/src/app.js`
- [User routes](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/routes/user.route.js): `Backend/src/routes/user.route.js`
- [Server bootstrap](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/index.js): `Backend/src/index.js`

### Identity and profiles

- [Login and tokens](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/controller.js): `Backend/src/controllers/controller.js`
- [User registration](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/userRegister.js): `Backend/src/controllers/userRegister.js`
- [Profile handlers](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/dashboard.js): `Backend/src/controllers/dashboard.js`
- [Password recovery](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/forgetPassword.js): `Backend/src/controllers/forgetPassword.js`
- [Password update](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/updatePassword.js): `Backend/src/controllers/updatePassword.js`
- [Session check](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/controllers/user.check.js): `Backend/src/controllers/user.check.js`
- [JWT middleware](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/middleware/auth.Middleware.js): `Backend/src/middleware/auth.Middleware.js`

### Persistence and media

- [User model](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/model/model.js): `Backend/src/model/model.js`
- **MongoDB**
- [Upload handling](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/middleware/multer.Middleware.js): `Backend/src/middleware/multer.Middleware.js`
- [Cloudinary upload](https://github.com/bharatkhandelwal0/profilex/blob/master/Backend/src/utils/cloudinary.js): `Backend/src/utils/cloudinary.js`

### Other components

- **Visitor**

## Connections

- Visitor → Route app: opens (evidence: `README.md`)
- Route app → Landing page: routes to (evidence: `Frontend/src/App.jsx`)
- Route app → Registration form: routes to (evidence: `Frontend/src/App.jsx`)
- Route app → Login form: routes to (evidence: `Frontend/src/App.jsx`)
- Route app → OTP recovery screens: routes to (evidence: `Frontend/src/App.jsx`)
- Route app → Protected route: protects (evidence: `Frontend/src/App.jsx`)
- Route app → Profile dashboard: routes to (evidence: `Frontend/src/App.jsx`)
- Login form → User routes: POST login (evidence: `Frontend/src/components/login/LoginPage.jsx`)
- Registration form → User routes: POST register (evidence: `README.md`)
- OTP recovery screens → User routes: requests OTP flow (evidence: `README.md`)
- Protected route → User routes: checks session (evidence: `README.md`)
- Profile dashboard → User routes: GET dashboard (evidence: `Frontend/src/components/profile/Main.jsx`)
- Server bootstrap → Express app: starts (evidence: `Backend/src/index.js`)
- Server bootstrap → MongoDB: connects (evidence: `README.md`)
- Express app → User routes: mounts (evidence: `Backend/src/app.js`)
- User routes → Login and tokens: dispatches login (evidence: `Backend/src/routes/user.route.js`)
- User routes → User registration: dispatches registration (evidence: `Backend/src/routes/user.route.js`)
- User routes → Profile handlers: dispatches dashboard (evidence: `Backend/src/routes/user.route.js`)
- User routes → Password recovery: dispatches OTP (evidence: `Backend/src/routes/user.route.js`)
- User routes → Password update: dispatches update (evidence: `Backend/src/routes/user.route.js`)
- User routes → Session check: dispatches check (evidence: `Backend/src/routes/user.route.js`)
- User routes → JWT middleware: guards routes (evidence: `Backend/src/routes/user.route.js`)
- JWT middleware → Session check: verifies access (evidence: `Backend/src/routes/user.route.js`)
- Login and tokens → User model: reads and saves (evidence: `Backend/src/controllers/controller.js`)
- User registration → User model: creates user (evidence: `Backend/src/controllers/userRegister.js`)
- Profile handlers → User model: reads profile (evidence: `Backend/src/controllers/dashboard.js`)
- Password recovery → User model: stores OTP (evidence: `README.md`)
- Password update → User model: updates password (evidence: `README.md`)
- User model → MongoDB: persists records (evidence: `README.md`)
- User routes → Upload handling: uses image upload (evidence: `Backend/src/routes/user.route.js`)
- User registration → Cloudinary upload: uploads image (evidence: `Backend/src/controllers/userRegister.js`)
- Upload handling → Cloudinary upload: stages file for
