https://github.com/mazen-r/event-driven-microservices
Event Driven Microservices.
https://github.com/mazen-r/event-driven-microservices
django docker flask mysql python rabbitmq
Last synced: 3 months ago
JSON representation
Event Driven Microservices.
- Host: GitHub
- URL: https://github.com/mazen-r/event-driven-microservices
- Owner: mazen-r
- Created: 2022-07-07T12:44:04.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-05T17:52:29.000Z (almost 3 years ago)
- Last Synced: 2023-08-05T18:41:49.274Z (almost 3 years ago)
- Topics: django, docker, flask, mysql, python, rabbitmq
- Language: Python
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Event Driven Microservices
## Tech:
- Python
- Django
- Flask
- SQLAlchemy
- MySQL
- RabbitMQ
- Docker
## System Architecture

## Overview
The app is divided into 2 main microservices:
- Admin
- Allows CRUD operations on products using Django REST
- Produces Products' data via RabbitMQ to the main service
- Consumes RabbiMQ messages from the main service to pefrom updates on products
- Main
- Allows to Edit/Delete/Like products where it's updated in the main serivce
- Consumes products' data and save it into Flask's db using SQLAlchemy
- Produces events to update data in the admin service
## How to run the app
- Main
- cd into the main directory and spin up the server using docker:
`docker-compose up --build`
- ssh into the backend container:
`docker-compose exec backend ssh`
- Create migration files:
`python manager.py db init`
- Apply the db migrations :
`python manager.py db migrate`
`python manager.py db upgrade`
- Admin
- cd into the admin directory and spin up the server using docker:
`docker-compose up --build`
- ssh into the backend container to:
`docker-compose exec backend ssh`
- Migrate Django's models into the db:
`python manage.py makemigrations`
`python manage.py migrate`
## Endpoints
- Main
- GET `/api/products` Fetch all products from admin db
- POST `/api/products//like` Like a product
- Admin
- GET `/api/products` Get all products
- POST `/api/products` Create a new product
- GET `/api/products/` Get one product
- PUT `/api/products/` Update product
- DELETE `/api/products/` Delete product