Simple Micro-service app using Golang and FastAPI
This repository implements a simple microservices application for a blogging platform using Golang and FastAPI. It serves as a learning project to explore new concepts in microservice architecture.
- API Gateway Service: Acts as an entry point to the system, routing requests to the appropriate microservices.
- User Service: Manages user data and authentication using Golang.
- Blog Service: Handles blog post creation, updating, and deletion using Golang.
- Analytics Service: Collects and analyzes usage data using FastAPI.
- Comment Service: Manages comments on blog posts using FastAPI.
The system uses an event-driven architecture to decouple services and improve scalability. Kafka is used as the messaging system to publish and subscribe to events.
- User Events: Events like
UserCreated
,UserUpdated
, andUserDeleted
are published by the User Service to Kafka. - Blog Events: Events like
BlogCreated
,BlogViewed
,BlogDeleted
,BlogLiked
,BlogDisliked
, andBlogClapped
are published by the Blog Service to Kafka. - Comment Events: The Comment Service consumes events such as
BlogViewed
to manage comment-related functionalities.
Kafka is used to handle the event-driven communication between microservices. The following Kafka-related configurations are used:
- Kafka Publisher: Each service has a Kafka publisher to send events to the Kafka topics.
- Kafka Consumer: Services can consume events from Kafka topics to perform specific actions based on the events.
-
Clone the repository:
git clone https://github.com/a-samir97/go-microservices.git cd go-microservices
-
Build and run the services:
docker-compose up --build
Based on the Makefile, here is the updated "Running Services" section in the README file:
You can use the provided Makefile to easily manage the services.
-
API Gateway Service:
make api-gateway-up
-
User Service:
make users-up
-
Blog Service:
make blogs-up
-
Analytics Service:
make analytics-up
-
Start All Services:
make up-all
-
Stop All Services:
make down-all
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.