# walidnoussir/samsar- architecture

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

- Interactive diagram: https://gitdiagram.com/walidnoussir/samsar-
- Repository: https://github.com/walidnoussir/samsar-

## Overview

Samsar connects renters and property owners through a React client and REST API. Renters browse/filter listings, inspect details, save favorites, and request or cancel reservations; owners publish and manage listings and review reservation requests. The API’s service layer applies domain rules and persists users, properties, favorites, and reservations. Image uploads are hosted by Cloudinary. Route and thunk wiring beyond sampled excerpts is represented only where the README or sampled code supports it; several backend routes and client feature modules were not inspected.

Main entry points: [`server/src/app.js`](https://github.com/walidnoussir/samsar-/blob/main/server/src/app.js) (Express API), [`client/src/services/api.js`](https://github.com/walidnoussir/samsar-/blob/main/client/src/services/api.js) (HTTP client), [`client/src/App.jsx`](https://github.com/walidnoussir/samsar-/blob/main/client/src/App.jsx) (Routes and layouts), [`client/src/features/properties/propertyThunks.js`](https://github.com/walidnoussir/samsar-/blob/main/client/src/features/properties/propertyThunks.js) (Property state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["Routes and layouts<br/>[App.jsx]"]
  node_browse["Browse listings<br/>[Properties.jsx]"]
  node_details["Listing details"]
  node_favorites_ui["Favorites<br/>[Favorites.jsx]"]
  node_renter_res["My reservations<br/>[MyReservations.jsx]"]
  node_owner_ui["Owner workspace"]
  node_auth_client["Auth state<br/>[authThunks.js]"]
  node_property_client["Property state<br/>[propertyThunks.js]"]
  node_favorite_client["Favorite state<br/>[favoriteThunks.js]"]
  node_reservation_client["Reservation state"]
  node_http["HTTP client<br/>[api.js]"]
end

subgraph group_api["API and services"]
  node_api["Express API<br/>[app.js]"]
  node_auth_routes["Auth routes<br/>[auth.route.js]"]
  node_property_routes["Property routes<br/>[property.route.js]"]
  node_favorite_routes["Favorite routes<br/>[favorite.routes.js]"]
  node_reservation_routes["Reservation routes"]
  node_auth_controller["Auth controller<br/>[auth.controller.js]"]
  node_property_controller["Property controller"]
  node_favorite_controller["Favorite controller"]
  node_reservation_controller["Reservation controller"]
  node_auth_service["Auth service<br/>[auth.service.js]"]
  node_property_service["Property service"]
  node_favorite_service["Favorite service"]
  node_reservation_service["Reservation service"]
end

subgraph group_data["Domain data"]
  node_users[("Users<br/>[User.js]")]
  node_properties[("Properties<br/>[Property.js]")]
  node_favorites[("Favorites<br/>[Favorite.js]")]
  node_reservations[("Reservations<br/>[Reservation.js]")]
end

subgraph group_integrations["External integrations"]
  node_mongo[("MongoDB")]
  node_cloudinary["Cloudinary"]
end

node_renter(("Renter"))
node_owner(("Property owner"))

node_renter -->|"uses"| node_app
node_owner -->|"uses"| node_app
node_app -->|"restores session"| node_auth_client
node_app -->|"loads favorites"| node_favorite_client
node_browse -->|"requests listings"| node_property_client
node_details -->|"requests listing"| node_property_client
node_favorites_ui -->|"manages favorites"| node_favorite_client
node_renter_res -->|"manages requests"| node_reservation_client
node_owner_ui -->|"manages listings"| node_property_client
node_owner_ui -->|"reviews requests"| node_reservation_client
node_auth_client -->|"sends requests"| node_http
node_property_client -->|"sends requests"| node_http
node_favorite_client -->|"sends requests"| node_http
node_reservation_client -->|"sends requests"| node_http
node_http -->|"HTTP requests"| node_api
node_api -->|"mounts"| node_auth_routes
node_api -->|"mounts"| node_property_routes
node_api -->|"mounts"| node_favorite_routes
node_api -->|"mounts"| node_reservation_routes
node_favorite_routes -->|"dispatches"| node_favorite_controller
node_auth_routes -->|"dispatches"| node_auth_controller
node_property_routes -->|"dispatches"| node_property_controller
node_reservation_routes -->|"dispatches"| node_reservation_controller
node_auth_controller -->|"calls"| node_auth_service
node_property_controller -->|"calls"| node_property_service
node_property_controller -->|"uploads images"| node_cloudinary
node_favorite_controller -->|"calls"| node_favorite_service
node_reservation_controller -->|"calls"| node_reservation_service
node_auth_service -->|"reads/writes"| node_users
node_property_service -->|"reads/writes"| node_properties
node_favorite_service -->|"reads/writes"| node_favorites
node_reservation_service -->|"reads/writes"| node_reservations
node_reservation_service -->|"checks/updates"| node_properties
node_users -->|"persists in"| node_mongo
node_properties -->|"persists in"| node_mongo
node_favorites -->|"persists in"| node_mongo
node_reservations -->|"persists in"| node_mongo

click node_app "https://github.com/walidnoussir/samsar-/blob/main/client/src/App.jsx"
click node_browse "https://github.com/walidnoussir/samsar-/blob/main/client/src/pages/Properties.jsx"
click node_details "https://github.com/walidnoussir/samsar-/blob/main/client/src/pages/PropertyDetails.jsx"
click node_favorites_ui "https://github.com/walidnoussir/samsar-/blob/main/client/src/pages/Favorites.jsx"
click node_renter_res "https://github.com/walidnoussir/samsar-/blob/main/client/src/pages/MyReservations.jsx"
click node_owner_ui "https://github.com/walidnoussir/samsar-/tree/main/client/src/pages/owner"
click node_auth_client "https://github.com/walidnoussir/samsar-/blob/main/client/src/features/auth/authThunks.js"
click node_property_client "https://github.com/walidnoussir/samsar-/blob/main/client/src/features/properties/propertyThunks.js"
click node_favorite_client "https://github.com/walidnoussir/samsar-/blob/main/client/src/features/favorites/favoriteThunks.js"
click node_reservation_client "https://github.com/walidnoussir/samsar-/blob/main/client/src/features/reservations/reservationThunks.js"
click node_http "https://github.com/walidnoussir/samsar-/blob/main/client/src/services/api.js"
click node_api "https://github.com/walidnoussir/samsar-/blob/main/server/src/app.js"
click node_auth_routes "https://github.com/walidnoussir/samsar-/blob/main/server/src/routes/auth.route.js"
click node_property_routes "https://github.com/walidnoussir/samsar-/blob/main/server/src/routes/property.route.js"
click node_favorite_routes "https://github.com/walidnoussir/samsar-/blob/main/server/src/routes/favorite.routes.js"
click node_reservation_routes "https://github.com/walidnoussir/samsar-/blob/main/server/src/routes/reservation.route.js"
click node_auth_controller "https://github.com/walidnoussir/samsar-/blob/main/server/src/controllers/auth.controller.js"
click node_property_controller "https://github.com/walidnoussir/samsar-/blob/main/server/src/controllers/property.controller.js"
click node_favorite_controller "https://github.com/walidnoussir/samsar-/blob/main/server/src/controllers/favorite.controller.js"
click node_reservation_controller "https://github.com/walidnoussir/samsar-/blob/main/server/src/controllers/reservation.controller.js"
click node_auth_service "https://github.com/walidnoussir/samsar-/blob/main/server/src/services/auth.service.js"
click node_property_service "https://github.com/walidnoussir/samsar-/blob/main/server/src/services/property.service.js"
click node_favorite_service "https://github.com/walidnoussir/samsar-/blob/main/server/src/services/favorite.service.js"
click node_reservation_service "https://github.com/walidnoussir/samsar-/blob/main/server/src/services/reservation.service.js"
click node_users "https://github.com/walidnoussir/samsar-/blob/main/server/src/models/User.js"
click node_properties "https://github.com/walidnoussir/samsar-/blob/main/server/src/models/Property.js"
click node_favorites "https://github.com/walidnoussir/samsar-/blob/main/server/src/models/Favorite.js"
click node_reservations "https://github.com/walidnoussir/samsar-/blob/main/server/src/models/Reservation.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_app,node_browse,node_details,node_favorites_ui,node_renter_res,node_owner_ui,node_auth_client,node_property_client,node_favorite_client,node_reservation_client,node_http toneBlue
class node_api,node_auth_routes,node_property_routes,node_favorite_routes,node_reservation_routes,node_auth_controller,node_property_controller,node_favorite_controller,node_reservation_controller,node_auth_service,node_property_service,node_favorite_service,node_reservation_service toneAmber
class node_users,node_properties,node_favorites,node_reservations toneMint
class node_mongo,node_cloudinary toneRose
class node_renter,node_owner toneIndigo
```

## Components

### Client experience

- [Routes and layouts](https://github.com/walidnoussir/samsar-/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Browse listings](https://github.com/walidnoussir/samsar-/blob/main/client/src/pages/Properties.jsx): `client/src/pages/Properties.jsx`
- [Listing details](https://github.com/walidnoussir/samsar-/blob/main/client/src/pages/PropertyDetails.jsx): `client/src/pages/PropertyDetails.jsx`
- [Favorites](https://github.com/walidnoussir/samsar-/blob/main/client/src/pages/Favorites.jsx): `client/src/pages/Favorites.jsx`
- [My reservations](https://github.com/walidnoussir/samsar-/blob/main/client/src/pages/MyReservations.jsx): `client/src/pages/MyReservations.jsx`
- [Owner workspace](https://github.com/walidnoussir/samsar-/tree/main/client/src/pages/owner): `client/src/pages/owner`
- [Auth state](https://github.com/walidnoussir/samsar-/blob/main/client/src/features/auth/authThunks.js): `client/src/features/auth/authThunks.js`
- [Property state](https://github.com/walidnoussir/samsar-/blob/main/client/src/features/properties/propertyThunks.js): `client/src/features/properties/propertyThunks.js`
- [Favorite state](https://github.com/walidnoussir/samsar-/blob/main/client/src/features/favorites/favoriteThunks.js): `client/src/features/favorites/favoriteThunks.js`
- [Reservation state](https://github.com/walidnoussir/samsar-/blob/main/client/src/features/reservations/reservationThunks.js): `client/src/features/reservations/reservationThunks.js`
- [HTTP client](https://github.com/walidnoussir/samsar-/blob/main/client/src/services/api.js): `client/src/services/api.js`

### API and services

- [Express API](https://github.com/walidnoussir/samsar-/blob/main/server/src/app.js): `server/src/app.js`
- [Auth routes](https://github.com/walidnoussir/samsar-/blob/main/server/src/routes/auth.route.js): `server/src/routes/auth.route.js`
- [Property routes](https://github.com/walidnoussir/samsar-/blob/main/server/src/routes/property.route.js): `server/src/routes/property.route.js`
- [Favorite routes](https://github.com/walidnoussir/samsar-/blob/main/server/src/routes/favorite.routes.js): `server/src/routes/favorite.routes.js`
- [Reservation routes](https://github.com/walidnoussir/samsar-/blob/main/server/src/routes/reservation.route.js): `server/src/routes/reservation.route.js`
- [Auth controller](https://github.com/walidnoussir/samsar-/blob/main/server/src/controllers/auth.controller.js): `server/src/controllers/auth.controller.js`
- [Property controller](https://github.com/walidnoussir/samsar-/blob/main/server/src/controllers/property.controller.js): `server/src/controllers/property.controller.js`
- [Favorite controller](https://github.com/walidnoussir/samsar-/blob/main/server/src/controllers/favorite.controller.js): `server/src/controllers/favorite.controller.js`
- [Reservation controller](https://github.com/walidnoussir/samsar-/blob/main/server/src/controllers/reservation.controller.js): `server/src/controllers/reservation.controller.js`
- [Auth service](https://github.com/walidnoussir/samsar-/blob/main/server/src/services/auth.service.js): `server/src/services/auth.service.js`
- [Property service](https://github.com/walidnoussir/samsar-/blob/main/server/src/services/property.service.js): `server/src/services/property.service.js`
- [Favorite service](https://github.com/walidnoussir/samsar-/blob/main/server/src/services/favorite.service.js): `server/src/services/favorite.service.js`
- [Reservation service](https://github.com/walidnoussir/samsar-/blob/main/server/src/services/reservation.service.js): `server/src/services/reservation.service.js`

### Domain data

- [Users](https://github.com/walidnoussir/samsar-/blob/main/server/src/models/User.js): `server/src/models/User.js`
- [Properties](https://github.com/walidnoussir/samsar-/blob/main/server/src/models/Property.js): `server/src/models/Property.js`
- [Favorites](https://github.com/walidnoussir/samsar-/blob/main/server/src/models/Favorite.js): `server/src/models/Favorite.js`
- [Reservations](https://github.com/walidnoussir/samsar-/blob/main/server/src/models/Reservation.js): `server/src/models/Reservation.js`

### External integrations

- **MongoDB**
- **Cloudinary**

### Other components

- **Renter**
- **Property owner**

## Connections

- Renter → Routes and layouts: uses
- Property owner → Routes and layouts: uses
- Routes and layouts → Auth state: restores session
- Routes and layouts → Favorite state: loads favorites
- Browse listings → Property state: requests listings
- Listing details → Property state: requests listing
- Favorites → Favorite state: manages favorites
- My reservations → Reservation state: manages requests
- Owner workspace → Property state: manages listings
- Owner workspace → Reservation state: reviews requests
- Auth state → HTTP client: sends requests
- Property state → HTTP client: sends requests
- Favorite state → HTTP client: sends requests
- Reservation state → HTTP client: sends requests
- HTTP client → Express API: HTTP requests
- Express API → Auth routes: mounts
- Express API → Property routes: mounts
- Express API → Favorite routes: mounts
- Express API → Reservation routes: mounts
- Favorite routes → Favorite controller: dispatches
- Auth routes → Auth controller: dispatches
- Property routes → Property controller: dispatches
- Reservation routes → Reservation controller: dispatches
- Auth controller → Auth service: calls
- Property controller → Property service: calls
- Property controller → Cloudinary: uploads images
- Favorite controller → Favorite service: calls
- Reservation controller → Reservation service: calls
- Auth service → Users: reads/writes
- Property service → Properties: reads/writes
- Favorite service → Favorites: reads/writes
- Reservation service → Reservations: reads/writes
- Reservation service → Properties: checks/updates
- Users → MongoDB: persists in
- Properties → MongoDB: persists in
- Favorites → MongoDB: persists in
- Reservations → MongoDB: persists in
