# johnngethe/airbnb_clone_v4 architecture

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

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

## Overview

This repository is an AirBnB-style clone prototype spanning a command interpreter, a Flask REST API, and a dynamic listing page, backed by shared domain models and selectable persistence. The principal web workflow is request → route handler → storage/model data → rendered page or JSON response. The README documents console create/read/update/delete operations; sampled console code confirms those operations use the shared storage interface. API route modules and several frontend capabilities are represented from the tree and README, but their source was not sampled, so uncertain internal wiring is omitted.

Main entry points: [`models/__init__.py`](https://github.com/johnngethe/airbnb_clone_v4/blob/master/models/__init__.py) (Storage selector), [`api/v1/views/__init__.py`](https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/__init__.py) (API blueprint), [`web_dynamic/0-hbnb.py`](https://github.com/johnngethe/airbnb_clone_v4/blob/master/web_dynamic/0-hbnb.py) (Listings page), [`console.py`](https://github.com/johnngethe/airbnb_clone_v4/blob/master/console.py) (Command console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_console["Command console<br/>[console.py]"]
  node_dynamic_page["Listings page<br/>[0-hbnb.py]"]
  node_dynamic_scripts["Browser scripts"]
end

subgraph group_api["REST API"]
  node_api_app["Flask API app<br/>[app.py]"]
  node_api_views["API blueprint<br/>[__init__.py]"]
  node_places_routes["Place routes<br/>[places.py]"]
  node_place_amenity_routes["Place amenities"]
  node_review_routes["Review routes<br/>[places_reviews.py]"]
  node_user_routes["User routes<br/>[users.py]"]
  node_location_routes["State and city routes"]
  node_amenity_routes["Amenity routes<br/>[amenities.py]"]
end

subgraph group_domain["Domain and storage"]
  node_model_base["Base model<br/>[base_model.py]"]
  node_domain_models["Domain entities"]
  node_storage_selector["Storage selector<br/>[__init__.py]"]
end

subgraph group_persistence["Persistence"]
  node_file_storage["JSON storage<br/>[file_storage.py]"]
  node_db_storage["SQL storage<br/>[db_storage.py]"]
  node_json_file[("JSON file")]
  node_mysql[("MySQL database")]
end

node_user(("User"))
node_browser(("Browser visitor"))

node_user -->|"enters commands"| node_console
node_console -->|"runs CRUD"| node_storage_selector
node_browser -->|"requests listings"| node_dynamic_page
node_dynamic_page -->|"loads listing data"| node_storage_selector
node_dynamic_page -->|"renders page"| node_browser
node_browser -->|"uses interactions"| node_dynamic_scripts
node_user -->|"sends requests"| node_api_app
node_api_app -->|"registers blueprint"| node_api_views
node_api_views -->|"dispatches"| node_places_routes
node_api_views -->|"dispatches"| node_place_amenity_routes
node_api_views -->|"dispatches"| node_review_routes
node_api_views -->|"dispatches"| node_user_routes
node_api_views -->|"dispatches"| node_location_routes
node_api_views -->|"dispatches"| node_amenity_routes
node_places_routes -->|"queries or mutates"| node_storage_selector
node_place_amenity_routes -->|"queries or mutates"| node_storage_selector
node_review_routes -->|"queries or mutates"| node_storage_selector
node_user_routes -->|"queries or mutates"| node_storage_selector
node_location_routes -->|"queries or mutates"| node_storage_selector
node_amenity_routes -->|"queries or mutates"| node_storage_selector
node_storage_selector -.->|"selects backend"| node_file_storage
node_storage_selector -.->|"selects backend"| node_db_storage
node_file_storage -->|"reads and writes"| node_json_file
node_db_storage -->|"queries and commits"| node_mysql
node_domain_models -->|"inherits behavior"| node_model_base

click node_console "https://github.com/johnngethe/airbnb_clone_v4/blob/master/console.py"
click node_dynamic_page "https://github.com/johnngethe/airbnb_clone_v4/blob/master/web_dynamic/0-hbnb.py"
click node_dynamic_scripts "https://github.com/johnngethe/airbnb_clone_v4/tree/master/web_dynamic/static/scripts"
click node_api_app "https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/app.py"
click node_api_views "https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/__init__.py"
click node_places_routes "https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/places.py"
click node_place_amenity_routes "https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/places_amenities.py"
click node_review_routes "https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/places_reviews.py"
click node_user_routes "https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/users.py"
click node_location_routes "https://github.com/johnngethe/airbnb_clone_v4/tree/master/api/v1/views"
click node_amenity_routes "https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/amenities.py"
click node_model_base "https://github.com/johnngethe/airbnb_clone_v4/blob/master/models/base_model.py"
click node_domain_models "https://github.com/johnngethe/airbnb_clone_v4/tree/master/models"
click node_storage_selector "https://github.com/johnngethe/airbnb_clone_v4/blob/master/models/__init__.py"
click node_file_storage "https://github.com/johnngethe/airbnb_clone_v4/blob/master/models/engine/file_storage.py"
click node_db_storage "https://github.com/johnngethe/airbnb_clone_v4/blob/master/models/engine/db_storage.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_page,node_dynamic_scripts,node_user,node_browser toneBlue
class node_api_app,node_api_views,node_places_routes,node_place_amenity_routes,node_review_routes,node_user_routes,node_location_routes,node_amenity_routes toneAmber
class node_model_base,node_domain_models,node_storage_selector toneMint
class node_file_storage,node_db_storage,node_json_file,node_mysql toneRose
```

## Components

### User interfaces

- [Command console](https://github.com/johnngethe/airbnb_clone_v4/blob/master/console.py): `console.py`
- [Listings page](https://github.com/johnngethe/airbnb_clone_v4/blob/master/web_dynamic/0-hbnb.py): `web_dynamic/0-hbnb.py`
- [Browser scripts](https://github.com/johnngethe/airbnb_clone_v4/tree/master/web_dynamic/static/scripts): `web_dynamic/static/scripts`

### REST API

- [Flask API app](https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/app.py): `api/v1/app.py`
- [API blueprint](https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/__init__.py): `api/v1/views/__init__.py`
- [Place routes](https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/places.py): `api/v1/views/places.py`
- [Place amenities](https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/places_amenities.py): `api/v1/views/places_amenities.py`
- [Review routes](https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/places_reviews.py): `api/v1/views/places_reviews.py`
- [User routes](https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/users.py): `api/v1/views/users.py`
- [State and city routes](https://github.com/johnngethe/airbnb_clone_v4/tree/master/api/v1/views): `api/v1/views`
- [Amenity routes](https://github.com/johnngethe/airbnb_clone_v4/blob/master/api/v1/views/amenities.py): `api/v1/views/amenities.py`

### Domain and storage

- [Base model](https://github.com/johnngethe/airbnb_clone_v4/blob/master/models/base_model.py): `models/base_model.py`
- [Domain entities](https://github.com/johnngethe/airbnb_clone_v4/tree/master/models): `models`
- [Storage selector](https://github.com/johnngethe/airbnb_clone_v4/blob/master/models/__init__.py): `models/__init__.py`

### Persistence

- [JSON storage](https://github.com/johnngethe/airbnb_clone_v4/blob/master/models/engine/file_storage.py): `models/engine/file_storage.py`
- [SQL storage](https://github.com/johnngethe/airbnb_clone_v4/blob/master/models/engine/db_storage.py): `models/engine/db_storage.py`
- **JSON file**
- **MySQL database**

### Other components

- **User**
- **Browser visitor**

## Connections

- User → Command console: enters commands
- Command console → Storage selector: runs CRUD
- Browser visitor → Listings page: requests listings
- Listings page → Storage selector: loads listing data
- Listings page → Browser visitor: renders page
- Browser visitor → Browser scripts: uses interactions
- User → Flask API app: sends requests
- Flask API app → API blueprint: registers blueprint
- API blueprint → Place routes: dispatches
- API blueprint → Place amenities: dispatches
- API blueprint → Review routes: dispatches
- API blueprint → User routes: dispatches
- API blueprint → State and city routes: dispatches
- API blueprint → Amenity routes: dispatches
- Place routes → Storage selector: queries or mutates
- Place amenities → Storage selector: queries or mutates
- Review routes → Storage selector: queries or mutates
- User routes → Storage selector: queries or mutates
- State and city routes → Storage selector: queries or mutates
- Amenity routes → Storage selector: queries or mutates
- Storage selector → JSON storage: selects backend
- Storage selector → SQL storage: selects backend
- JSON storage → JSON file: reads and writes
- SQL storage → MySQL database: queries and commits
- Domain entities → Base model: inherits behavior
