How sabirkekw/ecommerce_go works
This repository implements an e-commerce backend as four Go services: authentication, product catalog, cart, and orders. A typical user flow authenticates through SSO, browses the catalog, adds products to a cart, then checks out; the cart service publishes checkout messages that the order service consumes. The services expose gRPC APIs and HTTP gateways, with PostgreSQL-backed state and Redis-backed cart storage. Edges reflect explicit wiring and calls shown in excerpts or the source index; cross-service runtime details not shown are omitted or marked unverified.
Main entry points: cart/service.go Cart service · order/service.go Order service · kafka-consumer.go Checkout consumer · app.go Auth gateway
Components 32
Identity
- Auth gateway
sso-service/internal/app/http/app.go - Auth gRPC
sso-service/internal/grpc/auth/server.go - Auth service
sso-service/internal/service/auth/auth.go - Auth repository
sso-service/internal/repository/auth.go - Auth database
sso-service/internal/repository/postgres.go
Product catalog
- Catalog gateway
products-service/internal/app/http/app.go - Catalog gRPC
products-service/internal/grpc/server/server.go - Catalog service
products-service/internal/service/service.go - Catalog repository
products-service/internal/repository/repository.go - Catalog database
products-service/internal/database/postgres/postgres.go
Cart and checkout
- Cart gateway
cart-service/internal/app/http/app.go - Cart gRPC
cart-service/internal/grpc/server/server.go - Cart service
cart-service/internal/service/cart/service.go - Cart PostgreSQL repo
cart-service/internal/repository/postgres/repository.go - Cart Redis repo
cart-service/internal/repository/redis/repository.go - Cart PostgreSQL
cart-service/internal/database/postgres/postgres.go - Cart Redis
cart-service/internal/database/redis/redis.go - Product client
cart-service/internal/grpc/client/products.go - Checkout publisher
cart-service/internal/service/messaging/kafka.go
Order processing
- Order gateway
order-service/internal/app/http/app.go - Order gRPC
order-service/internal/grpc/server/server.go - Order service
order-service/internal/services/order/service.go - Order repository
order-service/internal/repository/order.go - Order database
order-service/internal/database/postgres/postgres.go - Checkout consumer
order-service/internal/messaging/kafka-consumer.go - Product client
order-service/internal/grpc/products-client/client.go
API contracts
- SSO API
pkg/api/sso/sso.proto - Products API
pkg/api/products/products.proto - Cart API
pkg/api/cart/cart.proto - Order API
pkg/api/order/order.proto
Other components
- Shopper
- Kafka
Connections 28
- Shopper → Auth gateway: authenticates via
- Shopper → Catalog gateway: browses via
- Shopper → Cart gateway: manages cart
- Shopper → Order gateway: views orders
- Auth gateway → SSO API: serves API
sso-service/internal/app/http/app.go - Auth gRPC → Auth service: dispatches
sso-service/internal/grpc/auth/server.go - Auth service → Auth repository: uses
sso-service/internal/service/auth/auth.go - Auth repository → Auth database: queries
- Catalog gateway → Products API: serves API
products-service/internal/app/http/app.go - Catalog gRPC → Catalog service: dispatches
products-service/internal/grpc/server/server.go - Catalog service → Catalog repository: uses
- Catalog repository → Catalog database: queries
- Cart gateway → Cart API: serves API
cart-service/internal/app/http/app.go - Cart gRPC → Cart service: dispatches
cart-service/internal/grpc/server/server.go - Cart service → Cart PostgreSQL repo: uses
- Cart service → Cart Redis repo: uses
- Cart PostgreSQL repo → Cart PostgreSQL: queries
- Cart Redis repo → Cart Redis: reads/writes
- Cart service → Product client: checks products
- Cart service → Checkout publisher: publishes checkout
- Checkout publisher → Kafka: publishes messages
- Order gateway → Order API: serves API
order-service/internal/app/http/app.go - Order gRPC → Order service: dispatches
order-service/internal/grpc/server/server.go - Order service → Order repository: uses
- Order repository → Order database: queries
- Checkout consumer → Order service: forwards checkout
- Checkout consumer → Kafka: consumes messages
- Order service → Product client: checks products