# maucarrasz/holbertonschool-airbnb_clone_v4 architecture

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

- Interactive diagram: https://gitdiagram.com/maucarrasz/holbertonschool-airbnb_clone_v4
- Repository: https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4

## Overview

This repository is an early AirBnB/HBnB clone: the documented core is a command interpreter for creating, retrieving, updating, and deleting domain objects, with file or database storage. It also contains Flask web views and a versioned REST API for browsing and managing states, cities, places, users, amenities, and reviews. The graph shows the documented console workflow and relationships visible in the supplied excerpts or README; web and API internals not excerpted are represented at subsystem level, with no guessed call paths.

Main entry points: [`models`](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/tree/master/models) (Domain entities), [`console.py`](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/console.py) (Command interpreter), [`models/__init__.py`](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/models/__init__.py) (Storage selector), [`models/engine/file_storage.py`](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/models/engine/file_storage.py) (JSON storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_console["Command interpreter<br/>[console.py]"]
  node_dynamic_web["Dynamic web views"]
  node_flask_web["Flask web views"]
end

subgraph group_api["REST API"]
  node_api_app["API application<br/>[app.py]"]
  node_api_routes["Resource routes"]
  node_place_review_routes["Place reviews<br/>[places_reviews.py]"]
end

subgraph group_domain["Domain model"]
  node_base_model["Base model<br/>[base_model.py]"]
  node_domain_models["Domain entities"]
end

subgraph group_storage["Persistence"]
  node_file_storage[("JSON storage<br/>[file_storage.py]")]
  node_db_storage[("MySQL storage<br/>[db_storage.py]")]
  node_storage_selector["Storage selector<br/>[__init__.py]"]
end

node_operator(("CLI user"))
node_api_client(("API client"))
node_json_file["JSON file"]
node_mysql[("MySQL database")]

node_operator -->|"enters commands"| node_console
node_console -->|"manages objects"| node_domain_models
node_console -->|"persists commands"| node_file_storage
node_api_client -->|"sends requests"| node_api_app
node_api_app -->|"registers routes"| node_api_routes
node_api_routes -->|"uses entities"| node_domain_models
node_place_review_routes -->|"loads reviews"| node_domain_models
node_domain_models -->|"inherits from"| node_base_model
node_base_model -->|"saves and deletes"| node_storage_selector
node_storage_selector -->|"selects by config"| node_file_storage
node_storage_selector -->|"selects by config"| node_db_storage
node_file_storage -->|"reads and writes"| node_json_file
node_db_storage -->|"queries and commits"| node_mysql

click node_console "https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/console.py"
click node_dynamic_web "https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/tree/master/web_dynamic"
click node_flask_web "https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/tree/master/web_flask"
click node_api_app "https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/api/v1/app.py"
click node_api_routes "https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/tree/master/api/v1/views"
click node_base_model "https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/models/base_model.py"
click node_domain_models "https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/tree/master/models"
click node_place_review_routes "https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/api/v1/views/places_reviews.py"
click node_file_storage "https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/models/engine/file_storage.py"
click node_db_storage "https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/models/engine/db_storage.py"
click node_storage_selector "https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/models/__init__.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_console,node_dynamic_web,node_flask_web,node_operator,node_api_client toneBlue
class node_api_app,node_api_routes,node_place_review_routes,node_mysql toneAmber
class node_base_model,node_domain_models toneMint
class node_file_storage,node_db_storage,node_storage_selector toneRose
class node_json_file toneIndigo
```

## Components

### User interfaces

- [Command interpreter](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/console.py): `console.py`
- [Dynamic web views](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/tree/master/web_dynamic): `web_dynamic`
- [Flask web views](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/tree/master/web_flask): `web_flask`

### REST API

- [API application](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/api/v1/app.py): `api/v1/app.py`
- [Resource routes](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/tree/master/api/v1/views): `api/v1/views`
- [Place reviews](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/api/v1/views/places_reviews.py): `api/v1/views/places_reviews.py`

### Domain model

- [Base model](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/models/base_model.py): `models/base_model.py`
- [Domain entities](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/tree/master/models): `models`

### Persistence

- [JSON storage](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/models/engine/file_storage.py): `models/engine/file_storage.py`
- [MySQL storage](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/models/engine/db_storage.py): `models/engine/db_storage.py`
- [Storage selector](https://github.com/maucarrasz/holbertonschool-airbnb_clone_v4/blob/master/models/__init__.py): `models/__init__.py`

### Other components

- **CLI user**
- **API client**
- **JSON file**
- **MySQL database**

## Connections

- CLI user → Command interpreter: enters commands
- Command interpreter → Domain entities: manages objects (evidence: `console.py`)
- Command interpreter → JSON storage: persists commands
- API client → API application: sends requests
- API application → Resource routes: registers routes (evidence: `api/v1/app.py`)
- Resource routes → Domain entities: uses entities (evidence: `api/v1/views/amenities.py`)
- Place reviews → Domain entities: loads reviews (evidence: `api/v1/views/places_reviews.py`)
- Domain entities → Base model: inherits from (evidence: `models/place.py`)
- Base model → Storage selector: saves and deletes (evidence: `models/base_model.py`)
- Storage selector → JSON storage: selects by config (evidence: `models/__init__.py`)
- Storage selector → MySQL storage: selects by config (evidence: `models/__init__.py`)
- JSON storage → JSON file: reads and writes (evidence: `models/engine/file_storage.py`)
- MySQL storage → MySQL database: queries and commits (evidence: `models/engine/db_storage.py`)
