Skip to content

Microservices project using Flask . We Made 3 servers running using docker images for each one and 2 database using sqlite. The project is a book buying platform.

Notifications You must be signed in to change notification settings

BaraSedih11/Bazarcom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bazarcom 📚

GitHub repo size GitHub repo file count (file type) Python Version Pip Version GitHub last commit (branch) Version Contributors GitHub pull requests

Welcome to Bazarcom! This repository contains the source code for a simple e-commerce website built with Flask and SQLite.

About Bazarcom

Bazar.com is an online marketplace where users can browse and purchase a variety of products conveniently. Whether you're looking for electronics, fashion items, home decor, or more, Bazar.com has something for everyone.

Features

  • Get all books.
  • Get book by ID.
  • Get books by topic
  • Purchase a book

Technologies Used

  • Python (Flask)
  • SQLite
  • Docker

Getting Started

To get started with Bazarcom, follow these steps:

  1. Clone this repository to your local machine.
  2. To run the project using vscode terminal:
    • Install the required dependencies by running:
    • pip install -r requirements.txt
    • Uncomment the code for creating the database (from line 49 to 60):
    • with app.app_context():
          db.drop_all()
          db.create_all()
          book1 = Book(title='How to get a good grade in DOS in 40 minutes a day', topic="distributed_systems", price=10.99, quantity=100)
          book2 = Book(title='RPCs for Noobs', topic="distributed_systems", price=15.00, quantity=50)
          book3 = Book(title='Xen and the Art of Surviving Undergraduate School', topic="undergraduate_school", price=5.00, quantity=30)
          book4 = Book(title='Cooking for the Impatient Undergrad', topic="undergraduate_school", price=10.00, quantity=70)
          db.session.add(book1)
          db.session.add(book2)
          db.session.add(book3)
          db.session.add(book4)
          db.session.commit()
    • Start the catalog server:
    • python catalog/catalog.py

      Now the catalog server running on http://0.0.0.0:5000

      • If you need to run it another time you sould comment the code for database (from line 49 to 60) because it will recreate the database with the initial data.
    • Uncomment the code for creating the database (from line 49 to 51):
    • Start the order server:
    • python order/order.py

      Now the order server running on http://0.0.0.0:6000

      • If you need to run it another time you sould comment the code for database (from line 49 to 51) because it will recreate the database with the initial data.
    • Start the gateway server:
    • python start gateway/gateway.py

      Now the order server running on http://0.0.0.0:5050

  3. To run the project using docker to separate each service/server into separate docker container (Recomended):
    • Open powershell on your windows
    • Heads towards your project (copy the path from vscode) then enter this command on powershell:
    • cd 'path/to/project'
    • Now we need to build images for each one of the servers(make sure that docker server is running on your device):
      • Build catalog image
      cd catalog
      docker build -t catalog_service .
      • Build order image
      cd ..
      cd order
      docker build -t order_service .
      • Build gateway image:
      cd ..
      cd gateway
      docker build -t gateway_service
    • Now you need to run each image on a separate powershell window:
    • docker run -it -p 5000:5000 catalog_service
      docker run -it -p 6000:6000 order_service
      docker run -it -p 5050:5050 gateway_service
      • Now you can send any request via the gateway and it will works well.

Documentations

We've made postman documentation here

About

Microservices project using Flask . We Made 3 servers running using docker images for each one and 2 database using sqlite. The project is a book buying platform.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages