Skip to content

Dockerized Amazon Product Reviews CRUD API with MongoDB βš‘οΈπŸ›’

Notifications You must be signed in to change notification settings

SaadARazzaq/Product-Reviews-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Product-Reviews πŸ“

This project demonstrates a FastAPI application using Beanie ODM (Object Document Mapper) for MongoDB. The project is containerized using Docker and Docker Compose for easy setup and deployment.

Project Demonstration πŸ“Ή

Product Reviews API

Project Structure 🧱

Screenshot 2024-06-30 at 4 02 42β€―AM Screenshot 2024-06-30 at 3 57 41β€―AM
  • app/server/models/product_review.py: Defines the ProductReview and UpdateProductReview models using Beanie and Pydantic.
  • app/server/routes/product_review.py: Contains the API routes for handling product reviews.
  • app/server/app.py: The main FastAPI application setup, including route inclusion and database initialization.
  • app/server/database.py: Contains the database initialization logic.
  • main.py: The entry point for running the Uvicorn server.
  • Dockerfile: The Dockerfile for building the FastAPI application image.
  • docker-compose.yml: Docker Compose file for setting up the FastAPI and MongoDB services.
  • requirements.txt: Python dependencies required for the project.

Getting Started πŸƒ

Prerequisites πŸ“‹

  • Docker Desktop installed and up and running on your machine.

Installation πŸ› οΈ

  1. Clone the repository:

    git clone https://github.com/SaadARazzaq/Product-Reviews-API
    cd fastapi-beanie
  2. Build and start the Docker containers:

    docker-compose up --build
  3. The FastAPI application will be available at http://localhost:8000.

API Endpoints ⚑

Screenshot 2024-06-30 at 4 08 40β€―AM

Example Product Review Model Schema 🧩

{
    "name": "Saad Abdur Razzaq",
    "title": "MacBook Air M2",
    "rating": 5.0,
    "review": "Best Laptop in the world",
    "date": "2023-06-30T12:34:56.789Z"
}

Example Update Product Review Model Schema 🧩

{
    "name": "Taha Abdur Razzaq",
    "title": "HP Victus 16",
    "rating": 5.0,
    "review": "Worst Laptop in the world",
    "date": "2023-06-30T12:34:56.789Z"
}

Notes πŸ“’

  • Ensure MongoDB is running and accessible for the FastAPI application to function correctly.
  • The mongo_url in app/server/database.py is set to connect to a MongoDB instance at host.docker.internal.

This project was made with πŸ’– by Saad Abdur Razzaq

About

Dockerized Amazon Product Reviews CRUD API with MongoDB βš‘οΈπŸ›’

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published