{"id":26471088,"url":"https://github.com/nima-abdpoor/brain-blitz","last_synced_at":"2025-08-12T15:08:36.720Z","repository":{"id":213683898,"uuid":"734641218","full_name":"nima-abdpoor/brain-blitz","owner":"nima-abdpoor","description":"Multiplayer trivia game where players compete.","archived":false,"fork":false,"pushed_at":"2025-03-18T11:27:20.000Z","size":311,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-03-18T12:29:45.917Z","etag":null,"topics":["even-driven","game","go","kafka","microservice","mongo-db","postgresql","redis-cache","traefik","trivia","trivia-game","trivia-quiz-game"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nima-abdpoor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-22T08:04:03.000Z","updated_at":"2025-03-17T11:31:43.000Z","dependencies_parsed_at":"2024-02-11T08:19:32.777Z","dependency_job_id":"15a2d0b6-1485-4f8e-9184-7202102e5106","html_url":"https://github.com/nima-abdpoor/brain-blitz","commit_stats":null,"previous_names":["nima-abdpoor/brainblitz"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nima-abdpoor%2Fbrain-blitz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nima-abdpoor%2Fbrain-blitz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nima-abdpoor%2Fbrain-blitz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nima-abdpoor%2Fbrain-blitz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nima-abdpoor","download_url":"https://codeload.github.com/nima-abdpoor/brain-blitz/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244498515,"owners_count":20462344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["even-driven","game","go","kafka","microservice","mongo-db","postgresql","redis-cache","traefik","trivia","trivia-game","trivia-quiz-game"],"created_at":"2025-03-19T20:12:05.798Z","updated_at":"2025-08-12T15:08:36.705Z","avatar_url":"https://github.com/nima-abdpoor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 BrainBlitz\n\n## 🧩 Main Components\nThis project follows a microservices architecture for a multiplayer quiz game called Brain Blitz.  \n\n### 🛡️ 1. Traefik (API Gateway)\n* Acts as the reverse proxy and entry point for all external HTTP requests.\n* It routes all incoming requests to the appropriate microservice.\n* Manages the Authentication validation by forwarding requests to `Auth Service`.\n### 🔐 2. Auth Service\n* Manages user authentication by providing HTTP and gRPC servers.\n### 👤 3. User Service\n* Handles user registration `(SignUp)`, login `(SignIn)`, and `profile` retrieval.\n* Stores user credentials and metadata in a **PostgreSQL** database.\n### 🎮 4. Game Service\n* Orchestrates the game flow logic.\n* Persists game sessions, and scores in **MongoDB**.\n* Publishes: `MatchRequested`, and `GameCompleted` events and consumes `MatchCreated` event.\n### 🤝 5. Match Service\n* Subscribes to `MatchRequested` events, and publishes `MatchCreated` via **Kafka**.\n* Handles matchmaking logic to pair players for a game.\n* Stores matchmaking candidates in **Redis**.\n### 📨 6. Kafka (Event Broker)\n* Manages Asynchronous communication between services via event streams.\n* Topics: `match.requested`, `match.created`, `game.completed`\n### 🛢️ 7. Databases\n* **PostgreSQL**: Stores user data and credentials.\n* **MongoDB**: Stores game sessions, results, questions, answers, and history.\n* **Redis**: Temporary in-memory store for active match candidates.\n\nEach service is independently deployable, follows the single responsibility principle, and communicates either synchronously via HTTP/gRPC or asynchronously using Kafka.\n\n## 🚀 How to Run the Application\n\n### step 1: Create shared network with docker:\n```bash \ndocker network create bb-network\n```\n\n### step 3: Run all services in the main directory:\n```bash\ndocker-compose up -d\n```\n\n## System Architecture\n![Brain Blitz Architecture](./docs/architecture.png)\n\n## Replication Setup\nFor instructions on setting up MongoDB or PostgreSQL replication read: [MongoDB Replication Guide](docs/mongodb-replication.md), [PostgreSQL Replication Guide](docs/postgresql-replication.md)  \n[PostgreSQL vs. MongoDB Replication](docs/PostgreSQL-vs-MongoDB-replication.md)\n\n## ☸️ Kubernetes Init\nFor setting up kubernetes read: [Kubernetes Setup](docs/kubernetes-init.md)\n\n## 🤝 How to Contribute and Commit\n\n### Protobuf\nmake sure to have correct package name inside your .proto file.\n#### ```option go_package = \"contract/[YOUR_SERVICE]/golang\";```\n#### Example:\noption go_package = \"contract/match/golang\";\n### How to generate .go files from .proto file\n```bash\nprotoc --go_out=. --go-grpc_out=. contract/[YOUR_SERVICE]/proto/[YOUR_PROTO_FILE.proto]\n```\n#### Example:\n```bash\nprotoc --go_out=. --go-grpc_out=. contract/match/proto/match.proto\n```\n\nHappy coding! 🚀","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnima-abdpoor%2Fbrain-blitz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnima-abdpoor%2Fbrain-blitz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnima-abdpoor%2Fbrain-blitz/lists"}