How akash-aman/microservice works
Main Components to Highlight
• Shared Packages: Represent the common “pkg” directory, which contains utilities like database access, service discovery, different networking protocols (gRPC, HTTP, WebSocket), logging, OpenTelemetry instrumentation, and workerpool implementations.
• External Dependencies: Mark external service integrations such as Consul for service discovery, Kafka for messaging, and third-party libraries (Viper, Ants, Fx, etc.) that are used in initialization and runtime.
• Infrastructure and Observability: Use dedicated modules for infrastructure (bulk-factory, scheduler, states) and observability (OpenTelemetry – with metrics, logs, and tracing; various loggers like Zap, Logrus, and Zerolog) as core architectural elements.
• Configuration & Deployment: Include components like the Dockerfile, docker-compose, and the configuration files located in the “conf” directory that facilitate deployment and setup.
Relationships and Interactions
• Interactions between the “app” layer (the actual business-logic implementation including versioned API endpoints for “get_all” and “get_by_id”), infrastructure elements (like schedulers or bulk-factory processors), and the underlying database/ORM (using Ent).
• Communication channels for real-time and asynchronous processing: include WebSocket modules and Kafka messaging flows where applicable, along with workerpool management including custom implementations for adapting fixed or adaptive workloads.
Architectural Patterns and Design Principles
• Modularity & Reusability: Emphasize the modular nature of shared “pkg” components reused by multiple services.
• Dependency Injection/Initialization: Call out the use of frameworks like Fx that manage the lifecycle of service components.
Relevant Technologies and How They Fit
• Golang: Underlies the entire project.
• Echo: Represent as the HTTP server component providing RESTful endpoints.
• Ent and gqlgen: Include these near the ORM and GraphQL layers respectively.
• WebSocket: Detail both the “gobwas” and “gorilla” implementations available to the service.