How ajackti/go-ecommerce-microservices works
Main Components
• Microservices: At the core, you have distinct services such as the Catalog Read Service, Catalog Write Service, and Orders Service. Each microservice is a vertical slice encapsulating its own API endpoints (using Echo for REST and gRPC for internal calls), command & query handlers, data models, domain logic, and associated infrastructure code.
• Data Stores: Show multiple databases:
– Write-side databases: Postgres and EventStoreDB (for transactions and event sourcing).
– Read-side databases: MongoDB and Elasticsearch for NoSQL queries.
– Caching and other store components such as Redis.
• Observability/Monitoring & Logging: Identify components like OpenTelemetry (for distributed tracing, metrics collection), Prometheus with Grafana, and logging frameworks (Zap, structured logging with Uber FX).
• External Interfaces: Illustrate how clients or external systems access the application services through RESTful endpoints (Echo framework) and gRPC, along with Swagger/OpenAPI interfaces for documentation.
• Deployment and DevOps: Include Docker and docker-compose (plus Kubernetes/Helm aspects as noted) highlighting the deployment pipelines, container configurations, and CI/CD components (GitHub workflows, devcontainer setup).
Relationships and Data Flow
• Database Interactions: Represent how each service interacts with its underlying databases. For example, orders service writing to Postgres or EventStoreDB for audit purposes, while writing updated projections to MongoDB/Elasticsearch.
• Dependency Injection & Integration: Indicate that each service uses DI (via uber-go/fx) to resolve dependencies like logging, database connections, messaging pipelines, and HTTP/gRPC servers.
Underline Architectural Patterns and Design Principles
• Domain Driven Design: Make note of the domain, repository, infrastructure, and application (or service) layers that appear in each microservice slice.
Relevant Technologies and Components
• For the API layer: Echo (REST), swaggo/swag for documentation.
• For messaging: RabbitMQ (with its producers and consumers), and related libraries (amqp091-go).
• For storage: Postgres, MongoDB, Elasticsearch, EventStoreDB, Redis.
• For observability: OpenTelemetry (tracing and metrics), Prometheus, Grafana.
• For dependency injection: Uber Fx.
• For testing: Use mocks (via Mockery) and integration testing containers (testcontainers-go) – you might annotate these in a “development & testing tools” section.
Recommended Elements
• Clear Labels: Each service, database, message broker, and external system should have a distinct label.