This project follows a microservices architecture for a multiplayer quiz game called Brain Blitz.
- Acts as the reverse proxy and entry point for all external HTTP requests.
- It routes all incoming requests to the appropriate microservice.
- Manages the Authentication validation by forwarding requests to
Auth Service.
- Manages user authentication by providing HTTP and gRPC servers.
- Handles user registration
(SignUp), login(SignIn), andprofileretrieval. - Stores user credentials and metadata in a PostgreSQL database.
- Orchestrates the game flow logic.
- Persists game sessions, and scores in MongoDB.
- Publishes:
MatchRequested, andGameCompletedevents and consumesMatchCreatedevent.
- Subscribes to
MatchRequestedevents, and publishesMatchCreatedvia Kafka. - Handles matchmaking logic to pair players for a game.
- Stores matchmaking candidates in Redis.
- Manages Asynchronous communication between services via event streams.
- Topics:
match.requested,match.created,game.completed
- PostgreSQL: Stores user data and credentials.
- MongoDB: Stores game sessions, results, questions, answers, and history.
- Redis: Temporary in-memory store for active match candidates.
Each service is independently deployable, follows the single responsibility principle, and communicates either synchronously via HTTP/gRPC or asynchronously using Kafka.
docker network create bb-networkdocker-compose up -dFor instructions on setting up MongoDB or PostgreSQL replication read: MongoDB Replication Guide, PostgreSQL Replication Guide
PostgreSQL vs. MongoDB Replication
For setting up kubernetes read: Kubernetes Setup
make sure to have correct package name inside your .proto file.
option go_package = "contract/match/golang";
protoc --go_out=. --go-grpc_out=. contract/[YOUR_SERVICE]/proto/[YOUR_PROTO_FILE.proto]protoc --go_out=. --go-grpc_out=. contract/match/proto/match.protoHappy coding! 🚀
