# sania248/interviewvault architecture

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

- Interactive diagram: https://gitdiagram.com/sania248/interviewvault
- Repository: https://github.com/sania248/interviewvault

## Overview

InterviewVault lets candidates discover, read, and contribute interview experiences. The main path runs from browser pages to Express API routes and controllers, which query or update MongoDB; users can search and filter listings, open details, and then contribute or interact through authenticated operations. Separate flows cover registration/login, profiles, bookmarks, and owner-checked edits and deletions. The README documents these capabilities; the sampled source confirms the experience, authentication, and bookmark wiring, while several frontend scripts and user routes were not sampled, so their internal call details are not expanded.

Main entry points: [`frontend/app.js`](https://github.com/sania248/interviewvault/blob/main/frontend/app.js) (API requests), [`backend/server.js`](https://github.com/sania248/interviewvault/blob/main/backend/server.js) (Express application), [`backend/middleware/authMiddleware.js`](https://github.com/sania248/interviewvault/blob/main/backend/middleware/authMiddleware.js) (JWT verification), [`backend/routes/experienceRoutes.js`](https://github.com/sania248/interviewvault/blob/main/backend/routes/experienceRoutes.js) (Experience routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser experience"]
  node_browse["Browse and search<br/>[app.js]"]
  node_details["Experience details<br/>[experience.js]"]
  node_share["Share experience<br/>[share.js]"]
  node_account["Register and login<br/>[login.js]"]
  node_profile["Profile and posts<br/>[profile.js]"]
  node_bookmarks["Saved posts<br/>[bookmarks.js]"]
  node_edit["Edit experience<br/>[edit.js]"]
  node_browser_api["API requests<br/>[app.js]"]
end

subgraph group_api["API routing"]
  node_server["Express application<br/>[server.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_experience_routes["Experience routes"]
  node_user_routes["User routes<br/>[UserRoutes.js]"]
end

subgraph group_identity["Identity and access"]
  node_auth_controller["Account logic<br/>[authController.js]"]
  node_auth_middleware{{"JWT verification<br/>[authMiddleware.js]"}}
end

subgraph group_domain["Experience and users"]
  node_experience_controller["Experience operations"]
  node_user_controller["Profile and bookmarks<br/>[UserController.js]"]
end

subgraph group_storage["Persistence"]
  node_user_model[("User records<br/>[User.js]")]
  node_experience_model[("Experience records<br/>[Experience.js]")]
  node_activity_model[("User activity model<br/>[UserActivity.js]")]
end

node_candidate(("Candidate"))
node_mongo[("MongoDB")]

node_candidate -->|"searches"| node_browse
node_candidate -->|"registers or logs in"| node_account
node_candidate -->|"submits experience"| node_share
node_browse -->|"requests listings"| node_browser_api
node_details -->|"requests details"| node_browser_api
node_share -->|"submits post"| node_browser_api
node_account -->|"sends credentials"| node_browser_api
node_profile -->|"requests profile"| node_browser_api
node_bookmarks -->|"requests saved posts"| node_browser_api
node_edit -->|"updates post"| node_browser_api
node_browser_api -->|"calls API"| node_server
node_server -->|"mounts routes"| node_auth_routes
node_server -->|"mounts routes"| node_experience_routes
node_server -->|"mounts routes"| node_user_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_experience_routes -->|"dispatches"| node_experience_controller
node_experience_routes -->|"guards protected routes"| node_auth_middleware
node_auth_middleware -->|"continues request"| node_experience_controller
node_user_routes -->|"guards routes"| node_auth_middleware
node_auth_middleware -->|"continues request"| node_user_controller
node_auth_controller -->|"reads and writes"| node_user_model
node_experience_controller -->|"reads and writes"| node_experience_model
node_user_controller -->|"reads and writes"| node_user_model
node_user_controller -->|"loads bookmark target"| node_experience_model
node_server -->|"connects"| node_mongo
node_user_model -->|"persists data"| node_mongo
node_experience_model -->|"persists data"| node_mongo

click node_browse "https://github.com/sania248/interviewvault/blob/main/frontend/app.js"
click node_details "https://github.com/sania248/interviewvault/blob/main/frontend/experience.js"
click node_share "https://github.com/sania248/interviewvault/blob/main/frontend/share.js"
click node_account "https://github.com/sania248/interviewvault/blob/main/frontend/login.js"
click node_profile "https://github.com/sania248/interviewvault/blob/main/frontend/profile.js"
click node_bookmarks "https://github.com/sania248/interviewvault/blob/main/frontend/bookmarks.js"
click node_edit "https://github.com/sania248/interviewvault/blob/main/frontend/edit.js"
click node_browser_api "https://github.com/sania248/interviewvault/blob/main/frontend/app.js"
click node_server "https://github.com/sania248/interviewvault/blob/main/backend/server.js"
click node_auth_routes "https://github.com/sania248/interviewvault/blob/main/backend/routes/authRoutes.js"
click node_experience_routes "https://github.com/sania248/interviewvault/blob/main/backend/routes/experienceRoutes.js"
click node_user_routes "https://github.com/sania248/interviewvault/blob/main/backend/routes/UserRoutes.js"
click node_auth_controller "https://github.com/sania248/interviewvault/blob/main/backend/controllers/authController.js"
click node_auth_middleware "https://github.com/sania248/interviewvault/blob/main/backend/middleware/authMiddleware.js"
click node_experience_controller "https://github.com/sania248/interviewvault/blob/main/backend/controllers/experienceController.js"
click node_user_controller "https://github.com/sania248/interviewvault/blob/main/backend/controllers/UserController.js"
click node_user_model "https://github.com/sania248/interviewvault/blob/main/backend/models/User.js"
click node_experience_model "https://github.com/sania248/interviewvault/blob/main/backend/models/Experience.js"
click node_activity_model "https://github.com/sania248/interviewvault/blob/main/backend/models/UserActivity.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_browse,node_details,node_share,node_account,node_profile,node_bookmarks,node_edit,node_browser_api toneBlue
class node_server,node_auth_routes,node_experience_routes,node_user_routes,node_mongo toneAmber
class node_auth_controller,node_auth_middleware toneMint
class node_experience_controller,node_user_controller toneRose
class node_user_model,node_experience_model,node_activity_model,node_candidate toneIndigo
```

## Components

### Browser experience

- [Browse and search](https://github.com/sania248/interviewvault/blob/main/frontend/app.js): `frontend/app.js`
- [Experience details](https://github.com/sania248/interviewvault/blob/main/frontend/experience.js): `frontend/experience.js`
- [Share experience](https://github.com/sania248/interviewvault/blob/main/frontend/share.js): `frontend/share.js`
- [Register and login](https://github.com/sania248/interviewvault/blob/main/frontend/login.js): `frontend/login.js`
- [Profile and posts](https://github.com/sania248/interviewvault/blob/main/frontend/profile.js): `frontend/profile.js`
- [Saved posts](https://github.com/sania248/interviewvault/blob/main/frontend/bookmarks.js): `frontend/bookmarks.js`
- [Edit experience](https://github.com/sania248/interviewvault/blob/main/frontend/edit.js): `frontend/edit.js`
- [API requests](https://github.com/sania248/interviewvault/blob/main/frontend/app.js): `frontend/app.js`

### API routing

- [Express application](https://github.com/sania248/interviewvault/blob/main/backend/server.js): `backend/server.js`
- [Authentication routes](https://github.com/sania248/interviewvault/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Experience routes](https://github.com/sania248/interviewvault/blob/main/backend/routes/experienceRoutes.js): `backend/routes/experienceRoutes.js`
- [User routes](https://github.com/sania248/interviewvault/blob/main/backend/routes/UserRoutes.js): `backend/routes/UserRoutes.js`

### Identity and access

- [Account logic](https://github.com/sania248/interviewvault/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [JWT verification](https://github.com/sania248/interviewvault/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`

### Experience and users

- [Experience operations](https://github.com/sania248/interviewvault/blob/main/backend/controllers/experienceController.js): `backend/controllers/experienceController.js`
- [Profile and bookmarks](https://github.com/sania248/interviewvault/blob/main/backend/controllers/UserController.js): `backend/controllers/UserController.js`

### Persistence

- [User records](https://github.com/sania248/interviewvault/blob/main/backend/models/User.js): `backend/models/User.js`
- [Experience records](https://github.com/sania248/interviewvault/blob/main/backend/models/Experience.js): `backend/models/Experience.js`
- [User activity model](https://github.com/sania248/interviewvault/blob/main/backend/models/UserActivity.js): `backend/models/UserActivity.js`

### Other components

- **Candidate**
- **MongoDB**

## Connections

- Candidate → Browse and search: searches
- Candidate → Register and login: registers or logs in
- Candidate → Share experience: submits experience
- Browse and search → API requests: requests listings
- Experience details → API requests: requests details
- Share experience → API requests: submits post
- Register and login → API requests: sends credentials
- Profile and posts → API requests: requests profile
- Saved posts → API requests: requests saved posts
- Edit experience → API requests: updates post
- API requests → Express application: calls API
- Express application → Authentication routes: mounts routes
- Express application → Experience routes: mounts routes
- Express application → User routes: mounts routes
- Authentication routes → Account logic: dispatches
- Experience routes → Experience operations: dispatches
- Experience routes → JWT verification: guards protected routes
- JWT verification → Experience operations: continues request
- User routes → JWT verification: guards routes
- JWT verification → Profile and bookmarks: continues request
- Account logic → User records: reads and writes
- Experience operations → Experience records: reads and writes
- Profile and bookmarks → User records: reads and writes
- Profile and bookmarks → Experience records: loads bookmark target
- Express application → MongoDB: connects
- User records → MongoDB: persists data
- Experience records → MongoDB: persists data
