A simple use case of fastapi microservices project
Microservice is the approach of breaking down large monolith application into individual applications specializing
in a specific service/functionality.
This approach is often known as Service-Oriented Architecture or SOA.
In a microservice architecture, the application is broken down into several separate services that run in separate processes.
There is a different database for different functionality of the application and the services communicate with each other using the HTTP, AMQP, or a binary protocol like TCP, depending on the nature of each service.
This is a simple e-shop app that uses microservices, the aim of this project is to gain hands-on-experience developing
microservices using python FastAPI, communicate with a JS frontend and deploy docker images to a registry.
Client : React, Bootstrcloudap
Server : Fastapi, Redis
CI/CD: Docker, Dockerhub
To run this project follow the instructions below :
Clone this repo
cd Destination_folder
git clone https://github.com/Ihebdhouibi/Microservices-with-fastapi.gitRun the following command
cd Microservices-with-fastapi
pip install -r requirements.txt cd Microservices-with-fastapi/inventory-frontend
npm installTo run this project execute the following commands
cd Microservices-with-fastapi/inventory
uvicorn main:app --reload
python consumer.py cd Microservices-with-fastapi/payment
uvicorn main:app --reload --port=8001
python consumer.py cd Microservices-with-fastapi/inventory-frontend
npm startYou can also run demo version of this project by pulling the Docker images from DockerHub
docker pull houb94/frontend:1.0
docker pull houb94/inventory:1.0
docker pull houb94/payment:1.0After pulling the images run the following command to build containers
docker compose buildNow that the containers are built, run the following command
docker compose upAll you need to do now is to go to localhost:3000
Distributed under the MIT License. See LICENSE.txt for more information.
Email me 📧 [email protected]