# manasoko/homehaven architecture

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

- Interactive diagram: https://gitdiagram.com/manasoko/homehaven
- Repository: https://github.com/manasoko/homehaven

## Overview

HomeHaven is a real-estate marketplace: visitors discover and filter listings, inspect property and agent details, then contact agents; registered users and agents manage accounts and listings through a protected dashboard. The backend provides authentication, listing and agent APIs, persistent MySQL-backed domain data, and session-authenticated real-time messaging. The README documents OAuth, password reset, delivery states, and read receipts; unsampled implementation details are represented as capabilities without asserting uncertain call paths.

Main entry points: [`backend/src/server.ts`](https://github.com/manasoko/homehaven/blob/main/backend/src/server.ts) (HTTP and socket server), [`backend/src/routes/index.ts`](https://github.com/manasoko/homehaven/blob/main/backend/src/routes/index.ts) (API routes), [`frontend/src/App.tsx`](https://github.com/manasoko/homehaven/blob/main/frontend/src/App.tsx) (App shell), [`frontend/src/routes/publicRoutes.tsx`](https://github.com/manasoko/homehaven/blob/main/frontend/src/routes/publicRoutes.tsx) (Property discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_public["Property discovery<br/>[publicRoutes.tsx]"]
  node_property_pages["Property pages<br/>[PropertyPage.tsx]"]
  node_agent_pages["Agent profiles"]
  node_auth_pages["Account access<br/>[authRoutes.tsx]"]
  node_registration["Multi-type registration<br/>[main.tsx]"]
  node_dashboard_routes["Protected dashboard"]
  node_dashboard_pages["Listing management<br/>[AddProperty.tsx]"]
  node_chat_ui["Chat interface<br/>[ChatModal.tsx]"]
end

subgraph group_api["Backend API"]
  node_server["HTTP and socket server<br/>[server.ts]"]
  node_app_server["Express app<br/>[app.ts]"]
  node_routes["API routes<br/>[index.ts]"]
  node_auth_controller["Authentication handlers<br/>[auth.ts]"]
  node_property_controller["Property handlers<br/>[property.ts]"]
  node_agent_controller["Agent handlers<br/>[agent.ts]"]
  node_chat_controller["Chat handlers<br/>[chat.ts]"]
  node_auth_service["Auth and sessions<br/>[auth.ts]"]
  node_property_service["Listing logic<br/>[property.ts]"]
end

subgraph group_domain["Domain data"]
  node_models["Domain models<br/>[index.ts]"]
  node_mysql[("MySQL database")]
  node_cloudinary[("Image hosting")]
end

subgraph group_realtime["Real-time chat"]
  node_chat_service["Message service<br/>[chat.ts]"]
  node_socket_handlers["Conversation events<br/>[chats.ts]"]
  node_socket_io["Socket.IO setup<br/>[io.ts]"]
end

node_visitor(("Visitor or user"))

node_visitor -->|"uses"| node_app
node_app -->|"renders routes"| node_public
node_app -->|"renders routes"| node_auth_pages
node_public -->|"routes to"| node_property_pages
node_public -->|"routes to"| node_agent_pages
node_visitor -->|"submits details"| node_registration
node_registration -->|"posts registration"| node_auth_controller
node_visitor -->|"opens dashboard"| node_dashboard_routes
node_dashboard_routes -->|"routes to"| node_dashboard_pages
node_visitor -->|"sends messages"| node_chat_ui
node_server -->|"creates"| node_app_server
node_server -->|"initializes"| node_models
node_server -->|"initializes"| node_socket_io
node_server -->|"creates"| node_chat_service
node_server -->|"dispatches events"| node_socket_handlers
node_app_server -->|"mounts API"| node_routes
node_app_server -->|"checks connection"| node_mysql
node_routes -->|"dispatches auth"| node_auth_controller
node_routes -->|"dispatches listings"| node_property_controller
node_routes -->|"dispatches profiles"| node_agent_controller
node_routes -->|"dispatches chat"| node_chat_controller
node_auth_controller -->|"handles auth logic"| node_auth_service
node_property_controller -->|"handles listing logic"| node_property_service
node_models -->|"persists domain data"| node_mysql
node_property_service -.->|"stores listing images"| node_cloudinary
node_socket_handlers -->|"processes messages"| node_chat_service
node_socket_handlers -->|"uses rooms"| node_socket_io
node_chat_service -->|"persists messages"| node_models

click node_app "https://github.com/manasoko/homehaven/blob/main/frontend/src/App.tsx"
click node_public "https://github.com/manasoko/homehaven/blob/main/frontend/src/routes/publicRoutes.tsx"
click node_property_pages "https://github.com/manasoko/homehaven/blob/main/frontend/src/pages/public/PropertyPage.tsx"
click node_agent_pages "https://github.com/manasoko/homehaven/blob/main/frontend/src/pages/public/AgentProfilePage.tsx"
click node_auth_pages "https://github.com/manasoko/homehaven/blob/main/frontend/src/routes/authRoutes.tsx"
click node_registration "https://github.com/manasoko/homehaven/blob/main/frontend/src/components/auth/register/main.tsx"
click node_dashboard_routes "https://github.com/manasoko/homehaven/blob/main/frontend/src/routes/dashboardRoutes.tsx"
click node_dashboard_pages "https://github.com/manasoko/homehaven/blob/main/frontend/src/pages/dashboard/AddProperty.tsx"
click node_chat_ui "https://github.com/manasoko/homehaven/blob/main/frontend/src/components/chat/ChatModal.tsx"
click node_server "https://github.com/manasoko/homehaven/blob/main/backend/src/server.ts"
click node_app_server "https://github.com/manasoko/homehaven/blob/main/backend/src/app.ts"
click node_routes "https://github.com/manasoko/homehaven/blob/main/backend/src/routes/index.ts"
click node_auth_controller "https://github.com/manasoko/homehaven/blob/main/backend/src/controller/auth.ts"
click node_property_controller "https://github.com/manasoko/homehaven/blob/main/backend/src/controller/property.ts"
click node_agent_controller "https://github.com/manasoko/homehaven/blob/main/backend/src/controller/agent.ts"
click node_chat_controller "https://github.com/manasoko/homehaven/blob/main/backend/src/controller/chat.ts"
click node_auth_service "https://github.com/manasoko/homehaven/blob/main/backend/src/service/auth.ts"
click node_property_service "https://github.com/manasoko/homehaven/blob/main/backend/src/service/property.ts"
click node_chat_service "https://github.com/manasoko/homehaven/blob/main/backend/src/service/chat.ts"
click node_models "https://github.com/manasoko/homehaven/blob/main/backend/src/models/index.ts"
click node_socket_handlers "https://github.com/manasoko/homehaven/blob/main/backend/src/controller/socket/chats.ts"
click node_socket_io "https://github.com/manasoko/homehaven/blob/main/backend/src/sockets/io.ts"

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_public,node_property_pages,node_agent_pages,node_auth_pages,node_registration,node_dashboard_routes,node_dashboard_pages,node_chat_ui,node_visitor toneBlue
class node_server,node_app_server,node_routes,node_auth_controller,node_property_controller,node_agent_controller,node_chat_controller,node_auth_service,node_property_service toneAmber
class node_models,node_mysql,node_cloudinary toneMint
class node_chat_service,node_socket_handlers,node_socket_io toneRose
```

## Components

### Web experience

- [App shell](https://github.com/manasoko/homehaven/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Property discovery](https://github.com/manasoko/homehaven/blob/main/frontend/src/routes/publicRoutes.tsx): `frontend/src/routes/publicRoutes.tsx`
- [Property pages](https://github.com/manasoko/homehaven/blob/main/frontend/src/pages/public/PropertyPage.tsx): `frontend/src/pages/public/PropertyPage.tsx`
- [Agent profiles](https://github.com/manasoko/homehaven/blob/main/frontend/src/pages/public/AgentProfilePage.tsx): `frontend/src/pages/public/AgentProfilePage.tsx`
- [Account access](https://github.com/manasoko/homehaven/blob/main/frontend/src/routes/authRoutes.tsx): `frontend/src/routes/authRoutes.tsx`
- [Multi-type registration](https://github.com/manasoko/homehaven/blob/main/frontend/src/components/auth/register/main.tsx): `frontend/src/components/auth/register/main.tsx`
- [Protected dashboard](https://github.com/manasoko/homehaven/blob/main/frontend/src/routes/dashboardRoutes.tsx): `frontend/src/routes/dashboardRoutes.tsx`
- [Listing management](https://github.com/manasoko/homehaven/blob/main/frontend/src/pages/dashboard/AddProperty.tsx): `frontend/src/pages/dashboard/AddProperty.tsx`
- [Chat interface](https://github.com/manasoko/homehaven/blob/main/frontend/src/components/chat/ChatModal.tsx): `frontend/src/components/chat/ChatModal.tsx`

### Backend API

- [HTTP and socket server](https://github.com/manasoko/homehaven/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Express app](https://github.com/manasoko/homehaven/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [API routes](https://github.com/manasoko/homehaven/blob/main/backend/src/routes/index.ts): `backend/src/routes/index.ts`
- [Authentication handlers](https://github.com/manasoko/homehaven/blob/main/backend/src/controller/auth.ts): `backend/src/controller/auth.ts`
- [Property handlers](https://github.com/manasoko/homehaven/blob/main/backend/src/controller/property.ts): `backend/src/controller/property.ts`
- [Agent handlers](https://github.com/manasoko/homehaven/blob/main/backend/src/controller/agent.ts): `backend/src/controller/agent.ts`
- [Chat handlers](https://github.com/manasoko/homehaven/blob/main/backend/src/controller/chat.ts): `backend/src/controller/chat.ts`
- [Auth and sessions](https://github.com/manasoko/homehaven/blob/main/backend/src/service/auth.ts): `backend/src/service/auth.ts`
- [Listing logic](https://github.com/manasoko/homehaven/blob/main/backend/src/service/property.ts): `backend/src/service/property.ts`

### Domain data

- [Domain models](https://github.com/manasoko/homehaven/blob/main/backend/src/models/index.ts): `backend/src/models/index.ts`
- **MySQL database**
- **Image hosting**

### Real-time chat

- [Message service](https://github.com/manasoko/homehaven/blob/main/backend/src/service/chat.ts): `backend/src/service/chat.ts`
- [Conversation events](https://github.com/manasoko/homehaven/blob/main/backend/src/controller/socket/chats.ts): `backend/src/controller/socket/chats.ts`
- [Socket.IO setup](https://github.com/manasoko/homehaven/blob/main/backend/src/sockets/io.ts): `backend/src/sockets/io.ts`

### Other components

- **Visitor or user**

## Connections

- Visitor or user → App shell: uses
- App shell → Property discovery: renders routes
- App shell → Account access: renders routes
- Property discovery → Property pages: routes to
- Property discovery → Agent profiles: routes to
- Visitor or user → Multi-type registration: submits details
- Multi-type registration → Authentication handlers: posts registration
- Visitor or user → Protected dashboard: opens dashboard
- Protected dashboard → Listing management: routes to
- Visitor or user → Chat interface: sends messages
- HTTP and socket server → Express app: creates
- HTTP and socket server → Domain models: initializes
- HTTP and socket server → Socket.IO setup: initializes
- HTTP and socket server → Message service: creates
- HTTP and socket server → Conversation events: dispatches events
- Express app → API routes: mounts API
- Express app → MySQL database: checks connection
- API routes → Authentication handlers: dispatches auth
- API routes → Property handlers: dispatches listings
- API routes → Agent handlers: dispatches profiles
- API routes → Chat handlers: dispatches chat
- Authentication handlers → Auth and sessions: handles auth logic
- Property handlers → Listing logic: handles listing logic
- Domain models → MySQL database: persists domain data
- Listing logic → Image hosting: stores listing images
- Conversation events → Message service: processes messages
- Conversation events → Socket.IO setup: uses rooms
- Message service → Domain models: persists messages
