# jainvasu1/inrange architecture

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

- Interactive diagram: https://gitdiagram.com/jainvasu1/inrange
- Repository: https://github.com/jainvasu1/inrange

## Overview

InRange is a roommate-matching web application. Its main workflow is account registration and login, profile and preference setup, compatibility-based match browsing, then private messaging. The graph includes the documented product capabilities and the sampled server, route, controller, model, and matching layers. The frontend templates are present in the tree, but their API interactions were not sampled, so those links are not inferred.

Main entry points: [`server.js`](https://github.com/jainvasu1/inrange/blob/main/server.js) (HTTP and socket server), [`backend/controllers/profileController.js`](https://github.com/jainvasu1/inrange/blob/main/backend/controllers/profileController.js) (Profile and match handling), [`backend/routes/profile.js`](https://github.com/jainvasu1/inrange/blob/main/backend/routes/profile.js) (Profile routes), [`backend/routes/chat.js`](https://github.com/jainvasu1/inrange/blob/main/backend/routes/chat.js) (Chat routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_web_pages["Web pages"]
  node_server["HTTP and socket server<br/>[server.js]"]
end

subgraph group_access["Accounts and access"]
  node_auth_routes["Auth routes<br/>[auth.js]"]
  node_auth_controller["Account handling<br/>[authController.js]"]
  node_auth_middleware["JWT authentication<br/>[auth.js]"]
end

subgraph group_matching["Profiles and matching"]
  node_profile_routes["Profile routes<br/>[profile.js]"]
  node_profile_controller["Profile and match handling"]
  node_compatibility["Compatibility scoring"]
end

subgraph group_messaging["Private messaging"]
  node_chat_routes["Chat routes<br/>[chat.js]"]
  node_chat_controller["Chat history<br/>[chatController.js]"]
  node_message_model["Message records<br/>[Message.js]"]
end

subgraph group_persistence["Persistence"]
  node_user_model["User records<br/>[User.js]"]
  node_profile_model["Profile records<br/>[Profile.js]"]
  node_preferences_model["Preference records<br/>[Preferences.js]"]
  node_database_config["MongoDB connection<br/>[db.js]"]
end

node_roommate_seeker(("Roommate seeker"))
node_mongo[("MongoDB")]

node_roommate_seeker -.->|"uses"| node_web_pages
node_server -->|"serves"| node_web_pages
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_profile_routes
node_server -->|"mounts"| node_chat_routes
node_server -->|"connects"| node_database_config
node_database_config -->|"connects"| node_mongo
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"reads and writes"| node_user_model
node_profile_routes -->|"authenticates"| node_auth_middleware
node_profile_routes -->|"dispatches"| node_profile_controller
node_auth_middleware -->|"loads user"| node_user_model
node_profile_controller -->|"updates"| node_user_model
node_profile_controller -->|"reads and writes"| node_profile_model
node_profile_controller -->|"reads and writes"| node_preferences_model
node_profile_controller -->|"scores compatibility"| node_compatibility
node_chat_routes -->|"authenticates"| node_auth_middleware
node_chat_routes -->|"dispatches"| node_chat_controller
node_chat_controller -->|"loads history"| node_message_model
node_server -->|"stores socket messages"| node_message_model

click node_web_pages "https://github.com/jainvasu1/inrange/tree/main/frontend/static/templates"
click node_server "https://github.com/jainvasu1/inrange/blob/main/server.js"
click node_auth_routes "https://github.com/jainvasu1/inrange/blob/main/backend/routes/auth.js"
click node_auth_controller "https://github.com/jainvasu1/inrange/blob/main/backend/controllers/authController.js"
click node_auth_middleware "https://github.com/jainvasu1/inrange/blob/main/backend/middleware/auth.js"
click node_profile_routes "https://github.com/jainvasu1/inrange/blob/main/backend/routes/profile.js"
click node_profile_controller "https://github.com/jainvasu1/inrange/blob/main/backend/controllers/profileController.js"
click node_compatibility "https://github.com/jainvasu1/inrange/blob/main/backend/utils/compatibilityEngine.js"
click node_user_model "https://github.com/jainvasu1/inrange/blob/main/backend/models/User.js"
click node_profile_model "https://github.com/jainvasu1/inrange/blob/main/backend/models/Profile.js"
click node_preferences_model "https://github.com/jainvasu1/inrange/blob/main/backend/models/Preferences.js"
click node_database_config "https://github.com/jainvasu1/inrange/blob/main/backend/config/db.js"
click node_chat_routes "https://github.com/jainvasu1/inrange/blob/main/backend/routes/chat.js"
click node_chat_controller "https://github.com/jainvasu1/inrange/blob/main/backend/controllers/chatController.js"
click node_message_model "https://github.com/jainvasu1/inrange/blob/main/backend/models/Message.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_web_pages,node_server toneBlue
class node_auth_routes,node_auth_controller,node_auth_middleware,node_mongo toneAmber
class node_profile_routes,node_profile_controller,node_compatibility toneMint
class node_chat_routes,node_chat_controller,node_message_model toneRose
class node_user_model,node_profile_model,node_preferences_model,node_database_config,node_roommate_seeker toneIndigo
```

## Components

### Web experience

- [Web pages](https://github.com/jainvasu1/inrange/tree/main/frontend/static/templates): `frontend/static/templates`
- [HTTP and socket server](https://github.com/jainvasu1/inrange/blob/main/server.js): `server.js`

### Accounts and access

- [Auth routes](https://github.com/jainvasu1/inrange/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Account handling](https://github.com/jainvasu1/inrange/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [JWT authentication](https://github.com/jainvasu1/inrange/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`

### Profiles and matching

- [Profile routes](https://github.com/jainvasu1/inrange/blob/main/backend/routes/profile.js): `backend/routes/profile.js`
- [Profile and match handling](https://github.com/jainvasu1/inrange/blob/main/backend/controllers/profileController.js): `backend/controllers/profileController.js`
- [Compatibility scoring](https://github.com/jainvasu1/inrange/blob/main/backend/utils/compatibilityEngine.js): `backend/utils/compatibilityEngine.js`

### Private messaging

- [Chat routes](https://github.com/jainvasu1/inrange/blob/main/backend/routes/chat.js): `backend/routes/chat.js`
- [Chat history](https://github.com/jainvasu1/inrange/blob/main/backend/controllers/chatController.js): `backend/controllers/chatController.js`
- [Message records](https://github.com/jainvasu1/inrange/blob/main/backend/models/Message.js): `backend/models/Message.js`

### Persistence

- [User records](https://github.com/jainvasu1/inrange/blob/main/backend/models/User.js): `backend/models/User.js`
- [Profile records](https://github.com/jainvasu1/inrange/blob/main/backend/models/Profile.js): `backend/models/Profile.js`
- [Preference records](https://github.com/jainvasu1/inrange/blob/main/backend/models/Preferences.js): `backend/models/Preferences.js`
- [MongoDB connection](https://github.com/jainvasu1/inrange/blob/main/backend/config/db.js): `backend/config/db.js`

### Other components

- **Roommate seeker**
- **MongoDB**

## Connections

- Roommate seeker → Web pages: uses (evidence: `README.md`)
- HTTP and socket server → Web pages: serves (evidence: `server.js`)
- HTTP and socket server → Auth routes: mounts (evidence: `server.js`)
- HTTP and socket server → Profile routes: mounts (evidence: `server.js`)
- HTTP and socket server → Chat routes: mounts (evidence: `server.js`)
- HTTP and socket server → MongoDB connection: connects (evidence: `server.js`)
- MongoDB connection → MongoDB: connects (evidence: `backend/config/db.js`)
- Auth routes → Account handling: dispatches (evidence: `backend/routes/auth.js`)
- Account handling → User records: reads and writes (evidence: `backend/controllers/authController.js`)
- Profile routes → JWT authentication: authenticates (evidence: `backend/routes/profile.js`)
- Profile routes → Profile and match handling: dispatches (evidence: `backend/routes/profile.js`)
- JWT authentication → User records: loads user (evidence: `backend/middleware/auth.js`)
- Profile and match handling → User records: updates (evidence: `backend/controllers/profileController.js`)
- Profile and match handling → Profile records: reads and writes (evidence: `backend/controllers/profileController.js`)
- Profile and match handling → Preference records: reads and writes (evidence: `backend/controllers/profileController.js`)
- Profile and match handling → Compatibility scoring: scores compatibility (evidence: `backend/controllers/profileController.js`)
- Chat routes → JWT authentication: authenticates (evidence: `backend/routes/chat.js`)
- Chat routes → Chat history: dispatches (evidence: `backend/routes/chat.js`)
- Chat history → Message records: loads history (evidence: `backend/controllers/chatController.js`)
- HTTP and socket server → Message records: stores socket messages (evidence: `server.js`)
