# sdev2451-team1/earthbnb architecture

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

- Interactive diagram: https://gitdiagram.com/sdev2451-team1/earthbnb
- Repository: https://github.com/sdev2451-team1/earthbnb

## Overview

EarthBnB is a property-rental application with a Django REST backend and React frontend. The intended guest workflow is to set search filters, request paginated property results, and view property cards; the backend provides property and booking APIs alongside host management and JWT-based user authentication. The frontend also includes authentication and API client modules. Several frontend views and backend booking/property implementations are unsampled or TODOs, so uncertain runtime links are omitted; README capabilities are retained as documented subsystems.

Main entry points: [`booking_project_frontend/src/api/client.js`](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/api/client.js) (API client), [`booking_project_backend/booking_app/views.py`](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/views.py) (Django REST API), [`booking_project_backend/core/views.py`](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/core/views.py) (User endpoints), [`booking_project_frontend/src/components/property/SearchResults.jsx`](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/components/property/SearchResults.jsx) (Search results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Guest frontend"]
  node_app["App shell<br/>[App.jsx]"]
  node_search_filters["Search filters"]
  node_filters_hook["Filters hook"]
  node_search_results["Search results<br/>[SearchResults.jsx]"]
  node_pagination["Results pagination"]
  node_property_card["Property card<br/>[PropertyCard.jsx]"]
  node_api_client["API client<br/>[client.js]"]
  node_property_api["Property API<br/>[properties.js]"]
  node_auth_api["Authentication API<br/>[auth.js]"]
  node_booking_api["Booking API<br/>[bookings.js]"]
  node_host_api["Host API<br/>[hosts.js]"]
end

subgraph group_api["Backend API"]
  node_backend["Django REST API<br/>[views.py]"]
end

subgraph group_identity["Identity and access"]
  node_auth_views["User endpoints<br/>[views.py]"]
  node_user_model[("User profile<br/>[models.py]")]
  node_auth_serializers["User serializers<br/>[serializers.py]"]
  node_auth_routes["Authentication routes<br/>[urls.py]"]
end

subgraph group_rental["Rental domain"]
  node_property_model[("Property data<br/>[models.py]")]
  node_booking_model[("Booking data<br/>[models.py]")]
  node_property_serializers["Rental serializers<br/>[serializers.py]"]
  node_property_filters["Property filtering<br/>[filters.py]"]
  node_property_routes["Rental routes<br/>[urls.py]"]
end

node_guest(("Guest"))
node_external_api(("HTTP API"))

node_guest -->|"sets filters"| node_search_filters
node_filters_hook -->|"reads context"| node_search_filters
node_pagination -->|"reads page"| node_filters_hook
node_search_results -->|"renders cards"| node_property_card
node_app -.->|"serves interface"| node_guest
node_search_results -.->|"requests listings"| node_property_api
node_property_api -->|"sends requests"| node_api_client
node_auth_api -->|"sends requests"| node_api_client
node_host_api -->|"sends requests"| node_api_client
node_booking_api -.->|"sends requests"| node_api_client
node_external_api -.->|"HTTP requests"| node_api_client
node_property_routes -.->|"routes requests"| node_backend
node_backend -.->|"filters listings"| node_property_filters
node_backend -.->|"serializes results"| node_property_serializers
node_property_serializers -.->|"serializes data"| node_property_model
node_booking_api -.->|"manages bookings"| node_booking_model
node_host_api -.->|"manages listings"| node_property_model
node_auth_routes -->|"routes requests"| node_auth_views
node_auth_views -->|"reads profile"| node_user_model
node_auth_views -.->|"uses serializer"| node_auth_serializers

click node_app "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/App.jsx"
click node_search_filters "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/contexts/PropertySearchFiltersContext.jsx"
click node_filters_hook "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/hooks/usePropertySearchFilters.js"
click node_search_results "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/components/property/SearchResults.jsx"
click node_pagination "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/components/property/SearchResultsPagination.jsx"
click node_property_card "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/components/property/PropertyCard.jsx"
click node_api_client "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/api/client.js"
click node_property_api "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/api/properties.js"
click node_auth_api "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/api/auth.js"
click node_booking_api "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/api/bookings.js"
click node_host_api "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/api/hosts.js"
click node_backend "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/views.py"
click node_auth_views "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/core/views.py"
click node_user_model "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/core/models.py"
click node_auth_serializers "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/core/serializers.py"
click node_auth_routes "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/core/urls.py"
click node_property_model "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/models.py"
click node_booking_model "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/models.py"
click node_property_serializers "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/serializers.py"
click node_property_filters "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/filters.py"
click node_property_routes "https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/urls.py"

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_search_filters,node_filters_hook,node_search_results,node_pagination,node_property_card,node_api_client,node_property_api,node_auth_api,node_booking_api,node_host_api toneBlue
class node_backend toneAmber
class node_auth_views,node_user_model,node_auth_serializers,node_auth_routes,node_external_api toneMint
class node_property_model,node_booking_model,node_property_serializers,node_property_filters,node_property_routes toneRose
class node_guest toneIndigo
```

## Components

### Guest frontend

- [App shell](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/App.jsx): `booking_project_frontend/src/App.jsx`
- [Search filters](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/contexts/PropertySearchFiltersContext.jsx): `booking_project_frontend/src/contexts/PropertySearchFiltersContext.jsx`
- [Filters hook](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/hooks/usePropertySearchFilters.js): `booking_project_frontend/src/hooks/usePropertySearchFilters.js`
- [Search results](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/components/property/SearchResults.jsx): `booking_project_frontend/src/components/property/SearchResults.jsx`
- [Results pagination](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/components/property/SearchResultsPagination.jsx): `booking_project_frontend/src/components/property/SearchResultsPagination.jsx`
- [Property card](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/components/property/PropertyCard.jsx): `booking_project_frontend/src/components/property/PropertyCard.jsx`
- [API client](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/api/client.js): `booking_project_frontend/src/api/client.js`
- [Property API](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/api/properties.js): `booking_project_frontend/src/api/properties.js`
- [Authentication API](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/api/auth.js): `booking_project_frontend/src/api/auth.js`
- [Booking API](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/api/bookings.js): `booking_project_frontend/src/api/bookings.js`
- [Host API](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_frontend/src/api/hosts.js): `booking_project_frontend/src/api/hosts.js`

### Backend API

- [Django REST API](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/views.py): `booking_project_backend/booking_app/views.py`

### Identity and access

- [User endpoints](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/core/views.py): `booking_project_backend/core/views.py`
- [User profile](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/core/models.py): `booking_project_backend/core/models.py`
- [User serializers](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/core/serializers.py): `booking_project_backend/core/serializers.py`
- [Authentication routes](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/core/urls.py): `booking_project_backend/core/urls.py`

### Rental domain

- [Property data](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/models.py): `booking_project_backend/booking_app/models.py`
- [Booking data](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/models.py): `booking_project_backend/booking_app/models.py`
- [Rental serializers](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/serializers.py): `booking_project_backend/booking_app/serializers.py`
- [Property filtering](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/filters.py): `booking_project_backend/booking_app/filters.py`
- [Rental routes](https://github.com/sdev2451-team1/earthbnb/blob/main/booking_project_backend/booking_app/urls.py): `booking_project_backend/booking_app/urls.py`

### Other components

- **Guest**
- **HTTP API**

## Connections

- Guest → Search filters: sets filters (evidence: `booking_project_frontend/src/contexts/PropertySearchFiltersContext.jsx`)
- Filters hook → Search filters: reads context (evidence: `booking_project_frontend/src/hooks/usePropertySearchFilters.js`)
- Results pagination → Filters hook: reads page (evidence: `booking_project_frontend/src/components/property/SearchResultsPagination.jsx`)
- Search results → Property card: renders cards (evidence: `booking_project_frontend/src/components/property/SearchResults.jsx`)
- App shell → Guest: serves interface
- Search results → Property API: requests listings
- Property API → API client: sends requests (evidence: `booking_project_frontend/src/api/properties.js`)
- Authentication API → API client: sends requests (evidence: `booking_project_frontend/src/api/auth.js`)
- Host API → API client: sends requests (evidence: `booking_project_frontend/src/api/hosts.js`)
- Booking API → API client: sends requests
- HTTP API → API client: HTTP requests
- Rental routes → Django REST API: routes requests
- Django REST API → Property filtering: filters listings
- Django REST API → Rental serializers: serializes results
- Rental serializers → Property data: serializes data
- Booking API → Booking data: manages bookings
- Host API → Property data: manages listings
- Authentication routes → User endpoints: routes requests (evidence: `booking_project_backend/core/urls.py`)
- User endpoints → User profile: reads profile (evidence: `booking_project_backend/core/views.py`)
- User endpoints → User serializers: uses serializer
