# kinzarehman/lockedin architecture

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

- Interactive diagram: https://gitdiagram.com/kinzarehman/lockedin
- Repository: https://github.com/kinzarehman/lockedin

## Overview

Locked In is a MERN challenge tracker: visitors learn about the product, create or recover an account, then enter member pages for onboarding, challenges, progress, rankings, and community encouragement. The sampled backend implements authentication and password recovery, while the README and landing page describe member capabilities that are still in progress; their internal data flows are not shown. Edges reflect explicit routing, calls, or documented behavior, with the browser-to-API connection marked unverified.

Main entry points: [`client/src/App.jsx`](https://github.com/kinzarehman/lockedin/blob/main/client/src/App.jsx) (Page router), [`server/routes/authRoutes.js`](https://github.com/kinzarehman/lockedin/blob/main/server/routes/authRoutes.js) (Auth endpoints), [`server/controllers/authController.js`](https://github.com/kinzarehman/lockedin/blob/main/server/controllers/authController.js) (Account operations), [`server/models/User.js`](https://github.com/kinzarehman/lockedin/blob/main/server/models/User.js) (User account model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["Page router<br/>[App.jsx]"]
  node_landing["Product landing<br/>[Landing.jsx]"]
  node_authpages["Signup and login<br/>[Signup.jsx]"]
  node_recoveryui["Password recovery<br/>[ForgotPassword.jsx]"]
  node_membernav["Member navigation<br/>[MemberLayout.jsx]"]
end

subgraph group_identity["Identity and sessions"]
  node_authapi["Auth API client<br/>[authApi.js]"]
  node_authroutes["Auth endpoints<br/>[authRoutes.js]"]
  node_authcontroller["Account operations<br/>[authController.js]"]
  node_authguard["Session guard<br/>[authMiddleware.js]"]
  node_recoverylimit["Recovery rate limit"]
  node_userlookup["Email account lookup<br/>[findUserByEmail.js]"]
  node_userschema["User account model<br/>[User.js]"]
  node_mongodb[("MongoDB")]
  node_emaildelivery["Reset email delivery"]
end

subgraph group_community["Challenge community"]
  node_questionnaire["Onboarding questionnaire<br/>[Questionnaire.jsx]"]
  node_challenges["Challenge selection<br/>[Challenges.jsx]"]
  node_dashboard["Progress dashboard<br/>[Dashboard.jsx]"]
  node_leaderboard["Community leaderboard<br/>[Leaderboard.jsx]"]
  node_inbox["Encouragement inbox<br/>[Inbox.jsx]"]
end

node_visitor(("Visitor / member"))
node_emailprovider["Email provider"]

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_authpages
node_app -->|"routes to"| node_recoveryui
node_app -->|"wraps member pages"| node_membernav
node_app -->|"routes to"| node_questionnaire
node_app -->|"routes to"| node_challenges
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_leaderboard
node_app -->|"routes to"| node_inbox
node_membernav -->|"requests logout"| node_authapi
node_authpages -->|"requests auth"| node_authapi
node_authapi -.->|"calls over HTTP"| node_authroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authroutes -->|"guards /me"| node_authguard
node_authroutes -->|"limits recovery"| node_recoverylimit
node_authcontroller -->|"reads and writes"| node_userschema
node_authcontroller -->|"finds accounts"| node_userlookup
node_userlookup -->|"queries"| node_userschema
node_authguard -->|"loads account"| node_userschema
node_userschema -->|"stores accounts"| node_mongodb
node_authcontroller -->|"sends reset link"| node_emaildelivery
node_emaildelivery -.->|"delivers email"| node_emailprovider

click node_app "https://github.com/kinzarehman/lockedin/blob/main/client/src/App.jsx"
click node_landing "https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Landing.jsx"
click node_authpages "https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Signup.jsx"
click node_recoveryui "https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/ForgotPassword.jsx"
click node_membernav "https://github.com/kinzarehman/lockedin/blob/main/client/src/components/MemberLayout.jsx"
click node_authapi "https://github.com/kinzarehman/lockedin/blob/main/client/src/api/authApi.js"
click node_authroutes "https://github.com/kinzarehman/lockedin/blob/main/server/routes/authRoutes.js"
click node_authcontroller "https://github.com/kinzarehman/lockedin/blob/main/server/controllers/authController.js"
click node_authguard "https://github.com/kinzarehman/lockedin/blob/main/server/middleware/authMiddleware.js"
click node_recoverylimit "https://github.com/kinzarehman/lockedin/blob/main/server/middleware/recoveryRateLimit.js"
click node_userlookup "https://github.com/kinzarehman/lockedin/blob/main/server/services/findUserByEmail.js"
click node_userschema "https://github.com/kinzarehman/lockedin/blob/main/server/models/User.js"
click node_emaildelivery "https://github.com/kinzarehman/lockedin/blob/main/server/services/passwordResetEmail.js"
click node_questionnaire "https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Questionnaire.jsx"
click node_challenges "https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Challenges.jsx"
click node_dashboard "https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Dashboard.jsx"
click node_leaderboard "https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Leaderboard.jsx"
click node_inbox "https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Inbox.jsx"

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_landing,node_authpages,node_recoveryui,node_membernav toneBlue
class node_authapi,node_authroutes,node_authcontroller,node_authguard,node_recoverylimit,node_userlookup,node_userschema,node_mongodb,node_emaildelivery toneAmber
class node_questionnaire,node_challenges,node_dashboard,node_leaderboard,node_inbox toneMint
class node_visitor,node_emailprovider toneIndigo
```

## Components

### Web experience

- [Page router](https://github.com/kinzarehman/lockedin/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Product landing](https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Landing.jsx): `client/src/pages/Landing.jsx`
- [Signup and login](https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Signup.jsx): `client/src/pages/Signup.jsx`
- [Password recovery](https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/ForgotPassword.jsx): `client/src/pages/ForgotPassword.jsx`
- [Member navigation](https://github.com/kinzarehman/lockedin/blob/main/client/src/components/MemberLayout.jsx): `client/src/components/MemberLayout.jsx`

### Identity and sessions

- [Auth API client](https://github.com/kinzarehman/lockedin/blob/main/client/src/api/authApi.js): `client/src/api/authApi.js`
- [Auth endpoints](https://github.com/kinzarehman/lockedin/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Account operations](https://github.com/kinzarehman/lockedin/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Session guard](https://github.com/kinzarehman/lockedin/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`
- [Recovery rate limit](https://github.com/kinzarehman/lockedin/blob/main/server/middleware/recoveryRateLimit.js): `server/middleware/recoveryRateLimit.js`
- [Email account lookup](https://github.com/kinzarehman/lockedin/blob/main/server/services/findUserByEmail.js): `server/services/findUserByEmail.js`
- [User account model](https://github.com/kinzarehman/lockedin/blob/main/server/models/User.js): `server/models/User.js`
- **MongoDB**
- [Reset email delivery](https://github.com/kinzarehman/lockedin/blob/main/server/services/passwordResetEmail.js): `server/services/passwordResetEmail.js`

### Challenge community

- [Onboarding questionnaire](https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Questionnaire.jsx): `client/src/pages/Questionnaire.jsx`
- [Challenge selection](https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Challenges.jsx): `client/src/pages/Challenges.jsx`
- [Progress dashboard](https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [Community leaderboard](https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Leaderboard.jsx): `client/src/pages/Leaderboard.jsx`
- [Encouragement inbox](https://github.com/kinzarehman/lockedin/blob/main/client/src/pages/Inbox.jsx): `client/src/pages/Inbox.jsx`

### Other components

- **Visitor / member**
- **Email provider**

## Connections

- Visitor / member → Page router: opens
- Page router → Product landing: routes to (evidence: `client/src/App.jsx`)
- Page router → Signup and login: routes to (evidence: `client/src/App.jsx`)
- Page router → Password recovery: routes to (evidence: `client/src/App.jsx`)
- Page router → Member navigation: wraps member pages (evidence: `client/src/App.jsx`)
- Page router → Onboarding questionnaire: routes to (evidence: `client/src/App.jsx`)
- Page router → Challenge selection: routes to (evidence: `client/src/App.jsx`)
- Page router → Progress dashboard: routes to (evidence: `client/src/App.jsx`)
- Page router → Community leaderboard: routes to (evidence: `client/src/App.jsx`)
- Page router → Encouragement inbox: routes to (evidence: `client/src/App.jsx`)
- Member navigation → Auth API client: requests logout (evidence: `client/src/components/MemberLayout.jsx`)
- Signup and login → Auth API client: requests auth (evidence: `client/src/pages/Signup.jsx`)
- Auth API client → Auth endpoints: calls over HTTP
- Auth endpoints → Account operations: dispatches (evidence: `server/routes/authRoutes.js`)
- Auth endpoints → Session guard: guards /me (evidence: `server/routes/authRoutes.js`)
- Auth endpoints → Recovery rate limit: limits recovery (evidence: `server/routes/authRoutes.js`)
- Account operations → User account model: reads and writes (evidence: `server/controllers/authController.js`)
- Account operations → Email account lookup: finds accounts (evidence: `server/controllers/authController.js`)
- Email account lookup → User account model: queries (evidence: `server/services/findUserByEmail.js`)
- Session guard → User account model: loads account (evidence: `server/middleware/authMiddleware.js`)
- User account model → MongoDB: stores accounts (evidence: `server/models/User.js`)
- Account operations → Reset email delivery: sends reset link (evidence: `server/controllers/authController.js`)
- Reset email delivery → Email provider: delivers email
