# sbalsara05/burrow-housing architecture

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

- Interactive diagram: https://gitdiagram.com/sbalsara05/burrow-housing
- Repository: https://github.com/sbalsara05/burrow-housing

## Overview

Burrow Housing is a housing marketplace for listing and discovering rentals, managing favorites and renter interest, and completing sublease agreements. The principal workflow runs from property search and listing details through an interest or chat interaction to an agreement, signature, and rent payment. The repository separates a React/Redux client from an Express/MongoDB API, with distinct authentication, property, ambassador, contract, and payment capabilities. Edges reflect excerpts, SOURCE INDEX references, or the README; client-to-API links are dashed because the sampled material does not establish their request wiring.

Main entry points: [`backend/server.js`](https://github.com/sbalsara05/burrow-housing/blob/main/backend/server.js) (HTTP API), [`backend/routes/favoritesRoutes.js`](https://github.com/sbalsara05/burrow-housing/blob/main/backend/routes/favoritesRoutes.js) (Favorites), [`backend/controllers/contractController.js`](https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/contractController.js) (Contract lifecycle), [`backend/controllers/stripeController.js`](https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/stripeController.js) (Rent payments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Housing client"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_navigation["Pages and routes<br/>[Navigation.tsx]"]
  node_clientstate["Client state<br/>[store.ts]"]
  node_propertyui["Search and listing UI"]
  node_dashboardui["Dashboard workflows"]
  node_chatui["Chat experience<br/>[ChatProvider.tsx]"]
  node_contractui["Agreement screens<br/>[AgreementsBody.tsx]"]
end

subgraph group_marketplace["Marketplace API"]
  node_api["HTTP API<br/>[server.js]"]
  node_auth["Authentication<br/>[authMiddleware.js]"]
  node_property["Property listings"]
  node_propertydata[("Property records<br/>[propertyModel.js]")]
  node_userdata[("User records<br/>[userModel.js]")]
  node_favorites["Favorites<br/>[favoritesRoutes.js]"]
  node_ambassador["Ambassador requests"]
  node_ambassadordata[("Ambassador request records")]
end

subgraph group_agreements["Agreements and payment"]
  node_contracts["Contract lifecycle"]
  node_contractdata[("Contract records<br/>[contractModel.js]")]
  node_stripe["Rent payments"]
  node_stripeprovider["Stripe service<br/>[stripeService.js]"]
end

subgraph group_engagement["Messaging and notifications"]
  node_chat["Chat integration<br/>[chatController.js]"]
  node_streamhook["Stream webhook"]
  node_notifications[("Notification records")]
  node_emailhelper["Email notification enqueue"]
  node_emailqueue["Email queue<br/>[emailQueue.js]"]
  node_emailservice["Email delivery<br/>[emailService.js]"]
end

node_renter(("Renter or lister"))
node_emailprovider(("Brevo email service"))
node_database[("MongoDB")]

node_renter -.->|"uses"| node_webapp
node_webapp -->|"loads routes"| node_navigation
node_webapp -->|"uses state"| node_clientstate
node_renter -.->|"searches listings"| node_propertyui
node_renter -.->|"manages housing"| node_dashboardui
node_renter -.->|"messages"| node_chatui
node_renter -.->|"reviews agreements"| node_contractui
node_propertyui -.->|"requests listings"| node_api
node_dashboardui -.->|"submits changes"| node_api
node_chatui -.->|"uses chat API"| node_api
node_contractui -.->|"uses contract API"| node_api
node_api -->|"mounts routes"| node_auth
node_api -->|"mounts routes"| node_property
node_api -->|"mounts routes"| node_favorites
node_api -->|"mounts routes"| node_ambassador
node_api -->|"mounts routes"| node_contracts
node_api -->|"mounts routes"| node_stripe
node_api -->|"mounts routes"| node_chat
node_api -->|"routes webhook"| node_streamhook
node_favorites -->|"authenticates requests"| node_auth
node_favorites -->|"reads and updates"| node_userdata
node_favorites -->|"looks up property"| node_propertydata
node_property -->|"reads and writes"| node_propertydata
node_property -->|"updates lister"| node_userdata
node_ambassador -->|"manages requests"| node_ambassadordata
node_contracts -->|"manages contracts"| node_contractdata
node_contracts -->|"loads property"| node_propertydata
node_contracts -->|"loads parties"| node_userdata
node_stripe -->|"updates payment state"| node_contractdata
node_stripe -->|"creates payment intents"| node_stripeprovider
node_stripe -->|"creates payment notices"| node_notifications
node_streamhook -->|"creates chat notices"| node_notifications
node_emailhelper -->|"queues email"| node_emailqueue
node_emailqueue -->|"sends notification"| node_emailservice
node_emailservice -.->|"delivers email"| node_emailprovider
node_auth -.->|"checks token revocation"| node_database

click node_webapp "https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/App.tsx"
click node_navigation "https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/navigation/Navigation.tsx"
click node_clientstate "https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/redux/slices/store.ts"
click node_propertyui "https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/components/inner-listing/listing-14/ListingFourteenArea.tsx"
click node_dashboardui "https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/components/dashboard/add-property/AddPropertyBody.tsx"
click node_chatui "https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/components/dashboard/chat/ChatProvider.tsx"
click node_api "https://github.com/sbalsara05/burrow-housing/blob/main/backend/server.js"
click node_auth "https://github.com/sbalsara05/burrow-housing/blob/main/backend/middlewares/authMiddleware.js"
click node_property "https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/propertyController.js"
click node_propertydata "https://github.com/sbalsara05/burrow-housing/blob/main/backend/models/propertyModel.js"
click node_userdata "https://github.com/sbalsara05/burrow-housing/blob/main/backend/models/userModel.js"
click node_favorites "https://github.com/sbalsara05/burrow-housing/blob/main/backend/routes/favoritesRoutes.js"
click node_ambassador "https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/ambassadorRequestController.js"
click node_ambassadordata "https://github.com/sbalsara05/burrow-housing/blob/main/backend/models/ambassadorRequestModel.js"
click node_contracts "https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/contractController.js"
click node_contractdata "https://github.com/sbalsara05/burrow-housing/blob/main/backend/models/contractModel.js"
click node_contractui "https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/components/dashboard/agreements/AgreementsBody.tsx"
click node_stripe "https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/stripeController.js"
click node_stripeprovider "https://github.com/sbalsara05/burrow-housing/blob/main/backend/services/stripeService.js"
click node_chat "https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/chatController.js"
click node_streamhook "https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/streamWebhookController.js"
click node_notifications "https://github.com/sbalsara05/burrow-housing/blob/main/backend/models/notificationModel.js"
click node_emailhelper "https://github.com/sbalsara05/burrow-housing/blob/main/backend/utils/notificationEmailHelper.js"
click node_emailqueue "https://github.com/sbalsara05/burrow-housing/blob/main/backend/queues/emailQueue.js"
click node_emailservice "https://github.com/sbalsara05/burrow-housing/blob/main/backend/services/emailService.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_webapp,node_navigation,node_clientstate,node_propertyui,node_dashboardui,node_chatui,node_contractui toneBlue
class node_api,node_auth,node_property,node_propertydata,node_userdata,node_favorites,node_ambassador,node_ambassadordata,node_database toneAmber
class node_contracts,node_contractdata,node_stripe,node_stripeprovider toneMint
class node_chat,node_streamhook,node_notifications,node_emailhelper,node_emailqueue,node_emailservice toneRose
class node_renter,node_emailprovider toneIndigo
```

## Components

### Housing client

- [Web application](https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/App.tsx): `homy/src/App.tsx`
- [Pages and routes](https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/navigation/Navigation.tsx): `homy/src/navigation/Navigation.tsx`
- [Client state](https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/redux/slices/store.ts): `homy/src/redux/slices/store.ts`
- [Search and listing UI](https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/components/inner-listing/listing-14/ListingFourteenArea.tsx): `homy/src/components/inner-listing/listing-14/ListingFourteenArea.tsx`
- [Dashboard workflows](https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/components/dashboard/add-property/AddPropertyBody.tsx): `homy/src/components/dashboard/add-property/AddPropertyBody.tsx`
- [Chat experience](https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/components/dashboard/chat/ChatProvider.tsx): `homy/src/components/dashboard/chat/ChatProvider.tsx`
- [Agreement screens](https://github.com/sbalsara05/burrow-housing/blob/main/homy/src/components/dashboard/agreements/AgreementsBody.tsx): `homy/src/components/dashboard/agreements/AgreementsBody.tsx`

### Marketplace API

- [HTTP API](https://github.com/sbalsara05/burrow-housing/blob/main/backend/server.js): `backend/server.js`
- [Authentication](https://github.com/sbalsara05/burrow-housing/blob/main/backend/middlewares/authMiddleware.js): `backend/middlewares/authMiddleware.js`
- [Property listings](https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/propertyController.js): `backend/controllers/propertyController.js`
- [Property records](https://github.com/sbalsara05/burrow-housing/blob/main/backend/models/propertyModel.js): `backend/models/propertyModel.js`
- [User records](https://github.com/sbalsara05/burrow-housing/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [Favorites](https://github.com/sbalsara05/burrow-housing/blob/main/backend/routes/favoritesRoutes.js): `backend/routes/favoritesRoutes.js`
- [Ambassador requests](https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/ambassadorRequestController.js): `backend/controllers/ambassadorRequestController.js`
- [Ambassador request records](https://github.com/sbalsara05/burrow-housing/blob/main/backend/models/ambassadorRequestModel.js): `backend/models/ambassadorRequestModel.js`

### Agreements and payment

- [Contract lifecycle](https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/contractController.js): `backend/controllers/contractController.js`
- [Contract records](https://github.com/sbalsara05/burrow-housing/blob/main/backend/models/contractModel.js): `backend/models/contractModel.js`
- [Rent payments](https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/stripeController.js): `backend/controllers/stripeController.js`
- [Stripe service](https://github.com/sbalsara05/burrow-housing/blob/main/backend/services/stripeService.js): `backend/services/stripeService.js`

### Messaging and notifications

- [Chat integration](https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/chatController.js): `backend/controllers/chatController.js`
- [Stream webhook](https://github.com/sbalsara05/burrow-housing/blob/main/backend/controllers/streamWebhookController.js): `backend/controllers/streamWebhookController.js`
- [Notification records](https://github.com/sbalsara05/burrow-housing/blob/main/backend/models/notificationModel.js): `backend/models/notificationModel.js`
- [Email notification enqueue](https://github.com/sbalsara05/burrow-housing/blob/main/backend/utils/notificationEmailHelper.js): `backend/utils/notificationEmailHelper.js`
- [Email queue](https://github.com/sbalsara05/burrow-housing/blob/main/backend/queues/emailQueue.js): `backend/queues/emailQueue.js`
- [Email delivery](https://github.com/sbalsara05/burrow-housing/blob/main/backend/services/emailService.js): `backend/services/emailService.js`

### Other components

- **Renter or lister**
- **Brevo email service**
- **MongoDB**

## Connections

- Renter or lister → Web application: uses
- Web application → Pages and routes: loads routes (evidence: `homy/src/App.tsx`)
- Web application → Client state: uses state (evidence: `homy/src/App.tsx`)
- Renter or lister → Search and listing UI: searches listings
- Renter or lister → Dashboard workflows: manages housing
- Renter or lister → Chat experience: messages
- Renter or lister → Agreement screens: reviews agreements
- Search and listing UI → HTTP API: requests listings
- Dashboard workflows → HTTP API: submits changes
- Chat experience → HTTP API: uses chat API
- Agreement screens → HTTP API: uses contract API
- HTTP API → Authentication: mounts routes (evidence: `backend/server.js`)
- HTTP API → Property listings: mounts routes (evidence: `backend/server.js`)
- HTTP API → Favorites: mounts routes (evidence: `backend/server.js`)
- HTTP API → Ambassador requests: mounts routes (evidence: `backend/server.js`)
- HTTP API → Contract lifecycle: mounts routes (evidence: `backend/server.js`)
- HTTP API → Rent payments: mounts routes (evidence: `backend/server.js`)
- HTTP API → Chat integration: mounts routes (evidence: `backend/server.js`)
- HTTP API → Stream webhook: routes webhook (evidence: `backend/server.js`)
- Favorites → Authentication: authenticates requests (evidence: `backend/routes/favoritesRoutes.js`)
- Favorites → User records: reads and updates (evidence: `backend/routes/favoritesRoutes.js`)
- Favorites → Property records: looks up property (evidence: `backend/routes/favoritesRoutes.js`)
- Property listings → Property records: reads and writes (evidence: `backend/controllers/propertyController.js`)
- Property listings → User records: updates lister (evidence: `backend/controllers/propertyController.js`)
- Ambassador requests → Ambassador request records: manages requests (evidence: `backend/controllers/ambassadorRequestController.js`)
- Contract lifecycle → Contract records: manages contracts (evidence: `backend/controllers/contractController.js`)
- Contract lifecycle → Property records: loads property (evidence: `backend/controllers/contractController.js`)
- Contract lifecycle → User records: loads parties (evidence: `backend/controllers/contractController.js`)
- Rent payments → Contract records: updates payment state (evidence: `backend/controllers/stripeController.js`)
- Rent payments → Stripe service: creates payment intents (evidence: `backend/controllers/stripeController.js`)
- Rent payments → Notification records: creates payment notices (evidence: `backend/controllers/stripeController.js`)
- Stream webhook → Notification records: creates chat notices (evidence: `backend/controllers/streamWebhookController.js`)
- Email notification enqueue → Email queue: queues email (evidence: `backend/utils/notificationEmailHelper.js`)
- Email queue → Email delivery: sends notification (evidence: `backend/queues/emailQueue.js`)
- Email delivery → Brevo email service: delivers email
- Authentication → MongoDB: checks token revocation
