Skip to content

Full-scale backend for a booking platform. Features a custom CLI for object management, RESTful API, and robust unit testing

Notifications You must be signed in to change notification settings

FrankieWilson1/python-booking-backend

Repository files navigation

0x00. AirBnB clone - The console

hbnb

🏠 AirBnB Clone - The Console

Python OOP Command Line

This repository contains the first step in creating a full-stack clone of the AirBnB web application. The focus of this project is on building a command-line interface (CLI) for managing objects, as well as implementing the backend logic and storage systems.

📚 Table of Contents

🔍 Project Overview

The AirBnB Clone - The Console is the first phase of a larger project to develop a clone of the AirBnB platform. This phase focuses on creating a Command Line Interface (CLI) that allows users to:

  • Create, read, update, and delete objects (CRUD operations).
  • Store and retrieve data using a custom file storage system.
  • Manage different classes for various AirBnB components (e.g., Users, Places, States).

🛠️ Technologies Used

  • Language: Python 3.7+
  • Storage: JSON-based file storage system
  • Paradigm: Object-Oriented Programming (OOP)
  • Testing: unittest module for unit testing
  • Development Tools:
    • pycodestyle (PEP 8 compliance)
    • cmd module for CLI implementation

🌟 Features

  • Interactive Command-Line Interface (CLI) for managing objects.
  • Persistent data storage using a custom JSON serialization and deserialization system.
  • Implementation of core AirBnB models:
    • User
    • Place
    • State
    • City
    • Amenity
    • Review
  • Object-Oriented Programming principles:
    • Class inheritance
    • Polymorphism
    • Encapsulation
  • Comprehensive unit tests for all modules and features.

📂 Project Structure

AirBnB_clone/
├── console.py          # Entry point of the command-line interface
├── models/             # Package containing all model classes
│   ├── __init__.py     # Initialization file for the models package
│   ├── base_model.py   # Base class for all models
│   ├── user.py         # User class
│   ├── place.py        # Place class
│   ├── state.py        # State class
│   ├── city.py         # City class
│   ├── amenity.py      # Amenity class
│   └── review.py       # Review class
├── models/engine/      # Package for storage engines
│   ├── __init__.py
│   ├── file_storage.py # File storage engine
├── tests/              # Unit tests for all modules
├── README.md           # Project documentation
└── AUTHORS             # List of project contributors

⚙️ Installation & Usage

Prerequisites

  • Python 3.7 or higher
  • pip (Python package manager)

Clone the Repository

git clone https://github.com/realFrankieWilson/AirBnB_clone.git
cd AirBnB_clone

Run the Console

Start the interactive console by running:

./console.py

Available Commands

The following commands are available in the console:

  • create <class_name>: Creates a new instance of a class.
  • show <class_name> <id>: Displays the string representation of an instance.
  • destroy <class_name> <id>: Deletes an instance based on its ID.
  • all [class_name]: Displays all instances (or instances of a specific class).
  • update <class_name> <id> <attribute_name> <attribute_value>: Updates an instance.

🖥️ Examples

Below are some examples of how to use the console:

$ ./console.py
(hbnb) create User
6f9f1c4a-9a68-4e6e-8c07-8d3f1b7c5c29
(hbnb) show User 6f9f1c4a-9a68-4e6e-8c07-8d3f1b7c5c29
[User] (6f9f1c4a-9a68-4e6e-8c07-8d3f1b7c5c29) {'id': '6f9f1c4a-9a68-4e6e-8c07-8d3f1b7c5c29', 'created_at': '2025-12-18T09:43:00', 'updated_at': '2025-12-18T09:43:00'}
(hbnb) all User
["[User] (6f9f1c4a-9a68-4e6e-8c07-8d3f1b7c5c29) {'id': '6f9f1c4a-9a68-4e6e-8c07-8d3f1b7c5c29', 'created_at': '2025-12-18T09:43:00', 'updated_at': '2025-12-18T09:43:00'}"]
(hbnb) destroy User 6f9f1c4a-9a68-4e6e-8c07-8d3f1b7c5c29
(hbnb) quit

🧠 Learning Objectives

By working on this project, you will:

  1. Understand the fundamentals of object-oriented programming (OOP).
  2. Learn how to implement a command-line interface (CLI) using Python's cmd module.
  3. Build a custom serialization and deserialization engine for persistent storage.
  4. Gain experience in creating and managing Python packages and modules.
  5. Write and execute unit tests to ensure code reliability and correctness.

🤝 Collaborators

This project was developed by the following contributors:

Note

Migrated from early ALX backend specialization (2023–2024). Collaborative project with @Gold-Israel. Demonstrates Backend skills: Command interpreter console for managing AirBnB objects CRUD operations: Create, Read (show/all), Update, and Delete objects Support for multiple object classes (BaseModel, User, State, City, Amenity, Place, Review) Interactive and non-interactive shell modes Object persistence and retrieval from storage Help system with command documentation Comprehensive test suite for validation

Authors

NAME EMAIL
Frank Ugwu Williams frankuwill101@gmail.com
Gold Israel techiegold101@gmail.com

About

Full-scale backend for a booking platform. Features a custom CLI for object management, RESTful API, and robust unit testing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •