How richardktran/kootha works
• id-generation-service – focused on ID generation with both HTTP and gRPC endpoints.
• quiz-session-service – which handles quiz session logic, includes both API gateway components for calling the id-generation service, in-memory and PostgreSQL repositories, and workers that process messages/events.
• user-service – responsible for user management with its own gRPC and HTTP handlers and similar internal structures seen in the other services.
Additionally, shared libraries and utilities are located in the pkg directory (e.g., discovery and message-broker wrappers) that enable interactions with Consul and Kafka. The api folder contains .proto files that serve as the API contracts for gRPC communication between services.
Main Components
• Frontline Services: Represent each microservice (id-generation-service, quiz-session-service, and user-service) as distinct nodes.
• API Layer: Indicate that these services expose gRPC endpoints (and in some cases, HTTP endpoints) with their respective protocol buffers definition (shown in the api directory).
• Data Persistence: Highlight PostgreSQL as a datastore used by at least quiz-session-service (and potentially others).
• Utility Components: Include shared utilities or libraries (grpcutil and discovery modules) that help glue services together.
Relationships and Interactions
• GRPC communication flows between services – for instance, quiz-session-service calling id-generation-service via a dedicated gateway (as seen in its internal/gateway/idgeneration).
• HTTP interactions where relevant (since there are HTTP handlers in id-generation-service and user-service).
• Service discovery interactions with Consul, indicating that services register/discover endpoints using the pkg/discovery modules.
Architectural Patterns and Design Principles
• Microservices: The project is clearly divided into isolated services that operate independently.
• API-Driven Communication: gRPC and Protobuf form the backbone for inter-service communication.
• Layered Components: Each service is organized into CMD (entry points), internal (handlers, service logic, repositories), and pkg (shared utilities/models) which suggests a clean separation of concerns.
• Event-Driven: The inclusion of message brokers (Kafka) suggests that asynchronous, event-driven patterns are employed.
• Service Discovery: The use of Consul emphasizes dynamic configuration and service registration.
Detail Orientation
• Avoid overcomplicating by only representing essential elements – the primary goal is clarity of communication between components.