Welcome to the HBnB Evolution Project, where we embark on creating a web application inspired by AirBnB using Python and Flask!
HBnB Evolution aims to replicate the functionality of AirBnB, allowing users to list places for rent, write reviews, and search for accommodations. This first part focuses on laying the foundation for our application's backend, including data modeling, API development, and testing.
Start by sketching out the application's backbone using UML (Unified Modeling Language) to create a blueprint for how our classes and components will interact. This step is crucial for visualizing the structure and relationships between different parts of our application.
Ensure everything works smoothly by creating comprehensive tests for the API endpoints and business logic. We utilize tools like unittest
in Python to automate testing and ensure reliability throughout the development process.
Implement the API using Flask, a lightweight and versatile web framework for Python. The API will serve as the interface for our application, handling HTTP requests and responses. Routes will be designed to support CRUD operations (Create, Read, Update, Delete) for entities such as places, users, reviews, and amenities.
Begin with a file-based system to store data, choosing between text, JSON, XML, or other formats. While this approach simplifies initial development and testing phases, future iterations will transition to a more robust database solution (e.g., PostgreSQL, MySQL) to handle scalability and data integrity requirements.
Wrap up the project by packaging everything into a Docker image. Docker containers provide a consistent environment for running applications, ensuring portability and ease of deployment across different platforms and environments.
-
Services Layer: Handles incoming requests and outgoing responses via the API. It acts as the interface between the client and the application's core logic.
-
Business Logic Layer: Core processing and decision-making component of the application. Here, rules such as user authentication, data validation, and business workflows are implemented.
-
Persistence Layer: Initially file-based, storing and retrieving data for the application. This layer interacts directly with the storage mechanism (e.g., files) to manage the application's data.
Places are the core entities of our application, representing accommodations available for rent. Each place includes attributes such as:
- Name, description
- Address, city, latitude, longitude
- Host (owner)
- Number of rooms, bathrooms
- Price per night, max guests
- Amenities (features like Wi-Fi, pools)
- Reviews (user feedback and ratings)
Users are individuals interacting with the application, categorized as hosts (owners of places) or reviewers (users leaving reviews). Key attributes include:
- Email (unique identifier)
- Password
- First name, last name
User-generated feedback and ratings for places. Each review contains:
- Rating (e.g., 1-5 stars)
- Comment
- Date of submission
Features available in places, such as Wi-Fi, pools, etc. Users can select from a predefined catalog or add new amenities as needed.
Places are associated with cities, and each city belongs to a country. This hierarchical structure facilitates categorization and search functionalities within the application.
-
Unique Users: Each user is uniquely identified by their email address.
-
One Host per Place: Every place must have exactly one designated host.
-
Flexible Hosting: A user can be a host for multiple places or none at all.
-
Open Reviewing: Users can submit reviews for places they do not own.
-
Amenity Options: Places can have multiple amenities from a predefined catalog, and users can contribute new amenities to expand the catalog.
-
City-Country Structure: Places are categorized under cities, and cities are associated with countries. This hierarchical organization supports efficient categorization and searching of places.
-
Unique ID (UUID4): Globally unique identifier for each entity, ensuring no overlap or ambiguity in data identification.
-
Creation Date (
created_at
): Timestamp indicating when an object was created, essential for auditing and data lifecycle management. -
Update Date (
updated_at
): Timestamp recording the last modification made to an object, aiding in tracking data changes and maintaining accuracy over time.
-
Uniqueness: UUID4 ensures each entity is distinct, crucial for scalable and reliable data management.
-
Traceability:
created_at
andupdated_at
timestamps provide a clear audit trail of entity lifecycle, facilitating debugging, auditing, and user interaction analysis.
-
Comprehensive testing is conducted using tools such as
curl
and HTTP methods (PUT
,GET
,POST
,DELETE
) to verify API functionality and behavior. -
Unit testing with
unittest
ensures individual components of the application like models function correctly, maintaining reliability and stability throughout development.
Members: Shukufa Bayramzada Simara Rustam
Collaboration: Our team works collaboratively to design, develop, and test the HBnB Evolution Project, ensuring a cohesive and effective implementation.
-
Type: File-based (initially)
-
Storage Format: Utilizes text, JSON, or XML files to store application data during early development stages. Future iterations will incorporate database solutions for enhanced scalability and performance.
We welcome contributions to the HBnB Evolution Project! To contribute, follow these steps:
-
Clone the repository:
git clone https://github.com/shukufabayramzada/holbertonschool-hbnb.git
cd holbertonschool-hbnb
-
Create a new branch:
git checkout -b feature/your-feature-name
-
Make your changes and commit:
git add .
git commit -m "Your commit message here"
-
Push to your branch:
git push origin feature/your-feature-name
-
Submit a pull request: Go to the repository on GitHub and submit a pull request from your branch to
main
. Provide a clear description of your changes, why they are needed, and any considerations for reviewers. -
Discuss and iterate: Participate in discussions and address any feedback or changes requested by the maintainers. Once approved, your pull request will be merged, and your contributions will be part of HBnB Evolution!
- Dependencies:
- All required packages are listed in
requirements.txt
. Install these dependencies usingpip install -r requirements.txt
to set up the development environment.