# bharathgoud07/sambandh-setu architecture

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

- Interactive diagram: https://gitdiagram.com/bharathgoud07/sambandh-setu
- Repository: https://github.com/bharathgoud07/sambandh-setu

## Overview

This is the backend for a matchmaking product whose core workflow moves matched users through a staged connection journey, including guided reflections and chat. The API also supports account and profile management, discovery, connection requests, notifications, and a home summary. The source index and excerpts support the route-to-controller links and several controller-to-model/service calls; other documented-by-code capabilities are included, but unsampled implementation details are not inferred.

Main entry points: [`backend/routes`](https://github.com/bharathgoud07/sambandh-setu/tree/backend/b1-b2-b3-complete/backend/routes) (API routes), [`backend/models/Connection.js`](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/Connection.js) (Connection records), [`backend/controllers/reflectionController.js`](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/reflectionController.js) (Guided reflections), [`backend/controllers/chatController.js`](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/chatController.js) (Chat operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_server["HTTP server<br/>[server.js]"]
  node_routes["API routes"]
  node_auth["Authentication<br/>[authController.js]"]
  node_authmw["Session authorization<br/>[requireAuth.js]"]
end

subgraph group_match["Matching and profiles"]
  node_users["User accounts<br/>[userController.js]"]
  node_profiles["Profile management"]
  node_discover["Partner discovery"]
  node_requests["Connection requests"]
  node_connections["Active connections"]
  node_connectiondata[("Connection records<br/>[Connection.js]")]
end

subgraph group_journey["Connection journey"]
  node_journeyapi["Journey operations"]
  node_journeylogic["Stage progression<br/>[journeyService.js]"]
  node_stagecontent[("Stage content<br/>[StageContent.js]")]
  node_reflection["Guided reflections"]
  node_questions[("Reflection questions")]
  node_answers[("Reflection answers")]
  node_home["Home summary<br/>[homeController.js]"]
end

subgraph group_engagement["Communication"]
  node_chat["Chat operations<br/>[chatController.js]"]
  node_chatdata[("Chat records<br/>[Chat.js]")]
  node_messages[("Messages<br/>[Message.js]")]
  node_notifications["Notifications"]
  node_notificationdata[("Notification records<br/>[Notification.js]")]
end

node_client(("API client"))

node_client -.->|"sends requests"| node_server
node_server -->|"mounts routes"| node_routes
node_routes -->|"routes auth"| node_auth
node_routes -->|"guards routes"| node_authmw
node_routes -->|"routes journey"| node_journeyapi
node_routes -->|"routes reflections"| node_reflection
node_routes -->|"routes chat"| node_chat
node_routes -->|"routes connections"| node_connections
node_routes -->|"routes home"| node_home
node_routes -->|"routes notifications"| node_notifications
node_routes -->|"routes requests"| node_requests
node_routes -->|"routes users"| node_users
node_routes -->|"routes profiles"| node_profiles
node_routes -->|"routes discovery"| node_discover
node_connections -->|"reads connections"| node_connectiondata
node_journeyapi -->|"reads connections"| node_connectiondata
node_journeyapi -->|"checks stages"| node_journeylogic
node_reflection -->|"checks stage access"| node_journeylogic
node_reflection -->|"reads questions"| node_questions
node_reflection -->|"reads and writes answers"| node_answers
node_reflection -->|"checks connection access"| node_connectiondata
node_journeylogic -->|"uses stage definitions"| node_connectiondata
node_chat -->|"reads and updates chats"| node_chatdata
node_chat -->|"reads and writes messages"| node_messages
node_chat -->|"checks active connections"| node_connectiondata
node_home -->|"summarizes connections"| node_connectiondata
node_home -->|"reads notifications"| node_notificationdata
node_notifications -->|"reads and updates notifications"| node_notificationdata
node_requests -->|"creates connections"| node_connectiondata
node_requests -->|"creates notifications"| node_notificationdata

click node_server "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/server.js"
click node_routes "https://github.com/bharathgoud07/sambandh-setu/tree/backend/b1-b2-b3-complete/backend/routes"
click node_auth "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/authController.js"
click node_authmw "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/middleware/requireAuth.js"
click node_users "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/userController.js"
click node_profiles "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/profileController.js"
click node_discover "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/discoverController.js"
click node_requests "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/requestController.js"
click node_connections "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/connectionController.js"
click node_connectiondata "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/Connection.js"
click node_journeyapi "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/journeyController.js"
click node_journeylogic "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/services/journeyService.js"
click node_stagecontent "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/StageContent.js"
click node_reflection "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/reflectionController.js"
click node_questions "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/ReflectionQuestion.js"
click node_answers "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/ReflectionAnswer.js"
click node_home "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/homeController.js"
click node_chat "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/chatController.js"
click node_chatdata "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/Chat.js"
click node_messages "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/Message.js"
click node_notifications "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/notificationController.js"
click node_notificationdata "https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/Notification.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_server,node_routes,node_auth,node_authmw,node_client toneBlue
class node_users,node_profiles,node_discover,node_requests,node_connections,node_connectiondata toneAmber
class node_journeyapi,node_journeylogic,node_stagecontent,node_reflection,node_questions,node_answers,node_home toneMint
class node_chat,node_chatdata,node_messages,node_notifications,node_notificationdata toneRose
```

## Components

### API and access

- [HTTP server](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/server.js): `backend/server.js`
- [API routes](https://github.com/bharathgoud07/sambandh-setu/tree/backend/b1-b2-b3-complete/backend/routes): `backend/routes`
- [Authentication](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Session authorization](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/middleware/requireAuth.js): `backend/middleware/requireAuth.js`

### Matching and profiles

- [User accounts](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Profile management](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/profileController.js): `backend/controllers/profileController.js`
- [Partner discovery](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/discoverController.js): `backend/controllers/discoverController.js`
- [Connection requests](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/requestController.js): `backend/controllers/requestController.js`
- [Active connections](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/connectionController.js): `backend/controllers/connectionController.js`
- [Connection records](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/Connection.js): `backend/models/Connection.js`

### Connection journey

- [Journey operations](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/journeyController.js): `backend/controllers/journeyController.js`
- [Stage progression](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/services/journeyService.js): `backend/services/journeyService.js`
- [Stage content](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/StageContent.js): `backend/models/StageContent.js`
- [Guided reflections](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/reflectionController.js): `backend/controllers/reflectionController.js`
- [Reflection questions](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/ReflectionQuestion.js): `backend/models/ReflectionQuestion.js`
- [Reflection answers](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/ReflectionAnswer.js): `backend/models/ReflectionAnswer.js`
- [Home summary](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/homeController.js): `backend/controllers/homeController.js`

### Communication

- [Chat operations](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/chatController.js): `backend/controllers/chatController.js`
- [Chat records](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/Chat.js): `backend/models/Chat.js`
- [Messages](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/Message.js): `backend/models/Message.js`
- [Notifications](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/controllers/notificationController.js): `backend/controllers/notificationController.js`
- [Notification records](https://github.com/bharathgoud07/sambandh-setu/blob/backend/b1-b2-b3-complete/backend/models/Notification.js): `backend/models/Notification.js`

### Other components

- **API client**

## Connections

- API client → HTTP server: sends requests
- HTTP server → API routes: mounts routes (evidence: `backend/server.js`)
- API routes → Authentication: routes auth (evidence: `backend/routes/authRoutes.js`)
- API routes → Session authorization: guards routes (evidence: `backend/routes/connectionRoutes.js`)
- API routes → Journey operations: routes journey (evidence: `backend/routes/connectionRoutes.js`)
- API routes → Guided reflections: routes reflections (evidence: `backend/routes/connectionRoutes.js`)
- API routes → Chat operations: routes chat (evidence: `backend/routes/chatRoutes.js`)
- API routes → Active connections: routes connections (evidence: `backend/routes/connectionRoutes.js`)
- API routes → Home summary: routes home (evidence: `backend/routes/homeRoutes.js`)
- API routes → Notifications: routes notifications (evidence: `backend/routes/notificationRoutes.js`)
- API routes → Connection requests: routes requests (evidence: `backend/routes/requestRoutes.js`)
- API routes → User accounts: routes users (evidence: `backend/routes/userRoutes.js`)
- API routes → Profile management: routes profiles (evidence: `backend/routes/userRoutes.js`)
- API routes → Partner discovery: routes discovery (evidence: `backend/routes/discoverRoutes.js`)
- Active connections → Connection records: reads connections (evidence: `backend/controllers/connectionController.js`)
- Journey operations → Connection records: reads connections (evidence: `backend/controllers/journeyController.js`)
- Journey operations → Stage progression: checks stages (evidence: `backend/controllers/journeyController.js`)
- Guided reflections → Stage progression: checks stage access (evidence: `backend/controllers/reflectionController.js`)
- Guided reflections → Reflection questions: reads questions (evidence: `backend/controllers/reflectionController.js`)
- Guided reflections → Reflection answers: reads and writes answers (evidence: `backend/controllers/reflectionController.js`)
- Guided reflections → Connection records: checks connection access
- Stage progression → Connection records: uses stage definitions (evidence: `backend/services/journeyService.js`)
- Chat operations → Chat records: reads and updates chats (evidence: `backend/controllers/chatController.js`)
- Chat operations → Messages: reads and writes messages (evidence: `backend/controllers/chatController.js`)
- Chat operations → Connection records: checks active connections (evidence: `backend/controllers/chatController.js`)
- Home summary → Connection records: summarizes connections (evidence: `backend/controllers/homeController.js`)
- Home summary → Notification records: reads notifications (evidence: `backend/controllers/homeController.js`)
- Notifications → Notification records: reads and updates notifications (evidence: `backend/controllers/notificationController.js`)
- Connection requests → Connection records: creates connections (evidence: `backend/controllers/requestController.js`)
- Connection requests → Notification records: creates notifications (evidence: `backend/controllers/requestController.js`)
