How moke-game/platform works
Based on our analysis of the file tree and the README, this project is a full-featured service platform—a mid-tier system that exposes a collection of microservices providing features such as authentication, analytics (BI logging), buddy management, chat (private/group/room chats), knapsack (inventory), leaderboard, mail, matchmaking, party management, player profile, and room management (with lockstep frame synchronization). The services are implemented as independent microservices (each with its own “service” and often a corresponding “client” entrypoint) and are defined via Protocol Buffers in the “api” directory. In addition, the project clearly separates “private” and “public” versions of each service (where private services are not JWT validated and are only accessible via mTLS, and public services require JWT authentication along with mTLS). There is robust containerization (using Docker and Kubernetes in the “deployment” folder) and automated CI/CD workflows provided in “.github/workflows.”
Main Components
• Client/Consumer Layer: This includes interactive clients (as demonstrated by the “cmd/{service}/client” directories) and integration test clients.
• API Gateway / Edge Services (if applicable): Although not explicitly detailed, you might want to note that clients may interact with both public and private variants of the services, possibly via an API gateway or load balancer pattern.
• Service Communication: Include the internal communication channels among services using gRPC (as indicated by the generated proto GRPC files) and HTTP (the API gateways often expose REST endpoints, as indicated by the *_gw.go files).
• Data Storage / Database Layer: Represent databases or storage systems that each microservice uses (for example, “internal/db” directories exist in many services). Though specifics aren’t provided, assume there are underlying databases (SQL or NoSQL) and Redis caches (noted in key files and "redis" directories) used by several services.
• External Integrations: Note connections to external services – such as the matchmaking integration with Open Match and Agones, and external BI platforms like ThinkingData, MixPanel, and ClickHouse for the analytics service.
Relationships and Interactions
• Inter-service communication flows (for example, the Auth service might serve as a gatekeeper for other services by validating and issuing JWT tokens).
Architectural Patterns and Design Principles to Highlight
• Microservices Architecture: Emphasize that each service is independently developed/deployed.
• Dual Service Endpoints Pattern: Clearly separate “public” endpoints (which enforce JWT authentication) from “private” endpoints (used for internal communication secured using mTLS).
• Containerization and CI/CD: Note the use of Docker, Kubernetes, and a CI/CD pipeline (GitHub workflows) to ensure modern delivery practices.
Technologies, Frameworks, and Libraries
• Language: Golang (as seen by go.mod and go.sum).
• Communication: gRPC and HTTP (via REST gateways generated from proto definitions).
• Security: JWT tokens for authentication and mTLS for service-to-service communication.
• External Tools: Open Match and Agones for matchmaking, and analytics integrations with ThinkingData, MixPanel, local file, and ClickHouse.
• Container Deployment: Docker (with Dockerfile in build/package/docker) and Kubernetes (with configs in deployment/k8s).