How datngth03/ecommerce-go-app works
Project Type and Purpose
• This is a Go-based e-commerce platform built with a modern microservices architecture.
• It consists of an API Gateway plus a set of independent microservices (user, auth, product, order, cart, payment, shipping, notification, inventory, review, search, recommendation).
• Services expose gRPC interfaces (back-end) and REST/OpenAPI through the API Gateway (front-end), persisting to dedicated databases (PostgreSQL, Redis) and exchanging events (message broker).
File Structure
• cmd/ holds the entrypoints for each microservice and the API Gateway.
• internal/ groups per-service modules into the layered structure:
• domain (entities, repositories)
• application (business logic)
• infrastructure (DB clients, message publishers)
• delivery (gRPC servers under each service’s delivery/grpc; API-Gateway HTTP handlers)
• api/ contains protobuf and OpenAPI specs.
• pkg/client/ contains generated gRPC clients for inter-service communication.
• migrations/ holds SQL schema migrations for each stateful service.
• docker-compose.yaml (and optional Kubernetes manifests) orchestrate containers: services, databases, message broker, cache, search engine.
• scripts/ automates proto generation, builds, and local environment setup.
Key Architectural Insights from README
• Bounded contexts per service.
• Communication via gRPC (synchronous RPC) and message broker (asynchronous events).
• Central API Gateway routing REST calls to gRPC services, enforcing authentication and rate-limiting.
• Each microservice owns its own datastore (Postgres or Redis) to ensure loose coupling.
• Shared infra for logging, metrics, tracing (OpenTelemetry) likely lives under internal/shared.