# sameerwork0207/myroommate_nashik architecture

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

- Interactive diagram: https://gitdiagram.com/sameerwork0207/myroommate_nashik
- Repository: https://github.com/sameerwork0207/myroommate_nashik

## Overview

MyRoommate is a roommate and rental-listing web application. Its backend serves the public site and listing/lead APIs, while route modules dispatch authentication, student-account, and admin operations to controllers and MongoDB models. OTP login can send email; bearer-token middleware protects student and admin routes. The tree also shows browser pages and scripts for listings, login, dashboard, and admin tasks, but their request wiring is not established by the supplied excerpts. Evidence is limited to the README (empty), source index, and shown source excerpts.

Main entry points: [`api/index.js`](https://github.com/sameerwork0207/myroommate_nashik/blob/main/api/index.js) (Express API), [`controllers/authController.js`](https://github.com/sameerwork0207/myroommate_nashik/blob/main/controllers/authController.js) (OTP authentication), [`routes/user.js`](https://github.com/sameerwork0207/myroommate_nashik/blob/main/routes/user.js) (Student routes), [`controllers/userController.js`](https://github.com/sameerwork0207/myroommate_nashik/blob/main/controllers/userController.js) (Student account)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Public experience"]
  node_site["Public pages<br/>[index.html]"]
  node_listing_ui["Listing browser<br/>[main.js]"]
  node_login_ui["Login interface<br/>[login.js]"]
  node_dashboard_ui["Student dashboard<br/>[dashboard.js]"]
  node_admin_ui["Admin console<br/>[admin.js]"]
end

subgraph group_api["API and workflows"]
  node_server["Express API<br/>[index.js]"]
  node_auth_routes["Authentication routes<br/>[auth.js]"]
  node_auth_flow["OTP authentication<br/>[authController.js]"]
  node_user_routes["Student routes<br/>[user.js]"]
  node_user_flow["Student account<br/>[userController.js]"]
  node_auth_guard["Token and role guard<br/>[authMiddleware.js]"]
  node_admin_routes["Admin routes<br/>[admin.js]"]
  node_admin_flow["Property and lead admin<br/>[adminController.js]"]
  node_listing_api["Listing and lead API<br/>[index.js]"]
end

subgraph group_data["Persistence"]
  node_db_setup["Database connection<br/>[db.js]"]
  node_user_model[("User records<br/>[User.js]")]
  node_listing_model[("Listing records<br/>[Listing.js]")]
  node_lead_model[("Lead records<br/>[Lead.js]")]
end

node_visitor(("Visitor"))
node_mailer["Email delivery"]
node_mongo[("MongoDB")]

node_visitor -->|"requests pages and APIs"| node_server
node_server -->|"serves static files"| node_site
node_server -->|"mounts auth"| node_auth_routes
node_server -->|"mounts admin"| node_admin_routes
node_server -->|"mounts student routes"| node_user_routes
node_server -->|"queries listings"| node_listing_model
node_server -->|"creates leads"| node_lead_model
node_server -->|"connects database"| node_db_setup
node_auth_routes -->|"dispatches auth"| node_auth_flow
node_auth_flow -->|"reads and updates users"| node_user_model
node_auth_flow -->|"sends OTP email"| node_mailer
node_user_routes -->|"protects student routes"| node_auth_guard
node_user_routes -->|"dispatches account actions"| node_user_flow
node_user_flow -->|"reads and updates users"| node_user_model
node_user_flow -->|"reads visit requests"| node_lead_model
node_admin_routes -->|"protects admin routes"| node_auth_guard
node_admin_routes -->|"dispatches admin actions"| node_admin_flow
node_admin_flow -->|"manages listings"| node_listing_model
node_admin_flow -->|"manages leads"| node_lead_model
node_db_setup -->|"connects"| node_mongo

click node_site "https://github.com/sameerwork0207/myroommate_nashik/blob/main/public/index.html"
click node_listing_ui "https://github.com/sameerwork0207/myroommate_nashik/blob/main/public/js/main.js"
click node_login_ui "https://github.com/sameerwork0207/myroommate_nashik/blob/main/public/js/login.js"
click node_dashboard_ui "https://github.com/sameerwork0207/myroommate_nashik/blob/main/public/js/dashboard.js"
click node_admin_ui "https://github.com/sameerwork0207/myroommate_nashik/blob/main/public/js/admin.js"
click node_server "https://github.com/sameerwork0207/myroommate_nashik/blob/main/api/index.js"
click node_auth_routes "https://github.com/sameerwork0207/myroommate_nashik/blob/main/routes/auth.js"
click node_auth_flow "https://github.com/sameerwork0207/myroommate_nashik/blob/main/controllers/authController.js"
click node_user_routes "https://github.com/sameerwork0207/myroommate_nashik/blob/main/routes/user.js"
click node_user_flow "https://github.com/sameerwork0207/myroommate_nashik/blob/main/controllers/userController.js"
click node_auth_guard "https://github.com/sameerwork0207/myroommate_nashik/blob/main/middlewares/authMiddleware.js"
click node_admin_routes "https://github.com/sameerwork0207/myroommate_nashik/blob/main/routes/admin.js"
click node_admin_flow "https://github.com/sameerwork0207/myroommate_nashik/blob/main/controllers/adminController.js"
click node_listing_api "https://github.com/sameerwork0207/myroommate_nashik/blob/main/api/index.js"
click node_db_setup "https://github.com/sameerwork0207/myroommate_nashik/blob/main/config/db.js"
click node_user_model "https://github.com/sameerwork0207/myroommate_nashik/blob/main/models/User.js"
click node_listing_model "https://github.com/sameerwork0207/myroommate_nashik/blob/main/models/Listing.js"
click node_lead_model "https://github.com/sameerwork0207/myroommate_nashik/blob/main/models/Lead.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_site,node_listing_ui,node_login_ui,node_dashboard_ui,node_admin_ui toneBlue
class node_server,node_auth_routes,node_auth_flow,node_user_routes,node_user_flow,node_auth_guard,node_admin_routes,node_admin_flow,node_listing_api,node_mongo toneAmber
class node_db_setup,node_user_model,node_listing_model,node_lead_model toneMint
class node_visitor,node_mailer toneIndigo
```

## Components

### Public experience

- [Public pages](https://github.com/sameerwork0207/myroommate_nashik/blob/main/public/index.html): `public/index.html`
- [Listing browser](https://github.com/sameerwork0207/myroommate_nashik/blob/main/public/js/main.js): `public/js/main.js`
- [Login interface](https://github.com/sameerwork0207/myroommate_nashik/blob/main/public/js/login.js): `public/js/login.js`
- [Student dashboard](https://github.com/sameerwork0207/myroommate_nashik/blob/main/public/js/dashboard.js): `public/js/dashboard.js`
- [Admin console](https://github.com/sameerwork0207/myroommate_nashik/blob/main/public/js/admin.js): `public/js/admin.js`

### API and workflows

- [Express API](https://github.com/sameerwork0207/myroommate_nashik/blob/main/api/index.js): `api/index.js`
- [Authentication routes](https://github.com/sameerwork0207/myroommate_nashik/blob/main/routes/auth.js): `routes/auth.js`
- [OTP authentication](https://github.com/sameerwork0207/myroommate_nashik/blob/main/controllers/authController.js): `controllers/authController.js`
- [Student routes](https://github.com/sameerwork0207/myroommate_nashik/blob/main/routes/user.js): `routes/user.js`
- [Student account](https://github.com/sameerwork0207/myroommate_nashik/blob/main/controllers/userController.js): `controllers/userController.js`
- [Token and role guard](https://github.com/sameerwork0207/myroommate_nashik/blob/main/middlewares/authMiddleware.js): `middlewares/authMiddleware.js`
- [Admin routes](https://github.com/sameerwork0207/myroommate_nashik/blob/main/routes/admin.js): `routes/admin.js`
- [Property and lead admin](https://github.com/sameerwork0207/myroommate_nashik/blob/main/controllers/adminController.js): `controllers/adminController.js`
- [Listing and lead API](https://github.com/sameerwork0207/myroommate_nashik/blob/main/api/index.js): `api/index.js`

### Persistence

- [Database connection](https://github.com/sameerwork0207/myroommate_nashik/blob/main/config/db.js): `config/db.js`
- [User records](https://github.com/sameerwork0207/myroommate_nashik/blob/main/models/User.js): `models/User.js`
- [Listing records](https://github.com/sameerwork0207/myroommate_nashik/blob/main/models/Listing.js): `models/Listing.js`
- [Lead records](https://github.com/sameerwork0207/myroommate_nashik/blob/main/models/Lead.js): `models/Lead.js`

### Other components

- **Visitor**
- **Email delivery**
- **MongoDB**

## Connections

- Visitor → Express API: requests pages and APIs (evidence: `api/index.js`)
- Express API → Public pages: serves static files (evidence: `api/index.js`)
- Express API → Authentication routes: mounts auth (evidence: `api/index.js`)
- Express API → Admin routes: mounts admin (evidence: `api/index.js`)
- Express API → Student routes: mounts student routes (evidence: `api/index.js`)
- Express API → Listing records: queries listings (evidence: `api/index.js`)
- Express API → Lead records: creates leads (evidence: `api/index.js`)
- Express API → Database connection: connects database (evidence: `api/index.js`)
- Authentication routes → OTP authentication: dispatches auth (evidence: `routes/auth.js`)
- OTP authentication → User records: reads and updates users (evidence: `controllers/authController.js`)
- OTP authentication → Email delivery: sends OTP email (evidence: `controllers/authController.js`)
- Student routes → Token and role guard: protects student routes (evidence: `routes/user.js`)
- Student routes → Student account: dispatches account actions (evidence: `routes/user.js`)
- Student account → User records: reads and updates users (evidence: `controllers/userController.js`)
- Student account → Lead records: reads visit requests (evidence: `controllers/userController.js`)
- Admin routes → Token and role guard: protects admin routes (evidence: `routes/admin.js`)
- Admin routes → Property and lead admin: dispatches admin actions (evidence: `routes/admin.js`)
- Property and lead admin → Listing records: manages listings (evidence: `controllers/adminController.js`)
- Property and lead admin → Lead records: manages leads (evidence: `controllers/adminController.js`)
- Database connection → MongoDB: connects (evidence: `config/db.js`)
