How sangeeth518/go-e_commerce-clean-arch works
This repository implements a Go e-commerce API and a separate notification consumer. The main workflow is an authenticated user request routed through Gin to a handler, business use case, and persistence or integration layer. Product capabilities also cover administration, accounts, categories, inventory and images, carts, checkout and orders, invoices, caching, and order notifications. The README provides no capability detail; the graph’s feature coverage comes from the source tree and indexed references. Some unsampled feature connections are omitted where ownership cannot be verified.
Main entry points: handler API handlers · inventory.go Inventory and images · order.go Checkout and orders · consumer.go Event consumer
Components 23
HTTP API
- API bootstrap
cmd/api/main.go - HTTP server
pkg/api/server.go - Route registration
pkg/routes/user.go - Auth middleware
pkg/api/middleware/auth.go - API handlers
pkg/api/handler
Commerce workflows
- Accounts and admin
pkg/usecase/user.go - Catalog and categories
pkg/usecase/category.go - Inventory and images
pkg/api/handler/inventory.go - Shopping cart
pkg/usecase/cart.go - Checkout and orders
pkg/usecase/order.go
Data and integrations
- Shared services
pkg/helper/helper.go - PostgreSQL repositories
pkg/repository/order.go - Database setup
pkg/db/db.go - Redis cache
pkg/db/redis_cache.go - Event publisher
pkg/publisher/publisher.go
Notifications
- Consumer bootstrap
notification-service/cmd/main.go - Event consumer
notification-service/pkg/consumer/consumer.go - Notification repository
notification-service/pkg/repository/notification.go - Email service
notification-service/pkg/service/email.go
Other components
- User
- RabbitMQ
- S3 object storage
- Email provider
Connections 27
- User → HTTP server: sends requests
- API bootstrap → HTTP server: starts
cmd/api/main.go - HTTP server → Route registration: registers routes
pkg/api/server.go - Route registration → API handlers: dispatches
pkg/routes/user.go - Route registration → Auth middleware: guards routes
pkg/routes/user.go - API handlers → Accounts and admin: invokes use cases
- API handlers → Catalog and categories: invokes use cases
- API handlers → Inventory and images: handles inventory
pkg/api/handler/inventory.go - API handlers → Shopping cart: invokes use cases
- API handlers → Checkout and orders: invokes use cases
pkg/api/handler/order.go - Inventory and images → PostgreSQL repositories: uses repository
- Inventory and images → Redis cache: reads and invalidates
- Inventory and images → Shared services: uses image services
- Shared services → S3 object storage: stores images
pkg/helper/helper.go - Shopping cart → PostgreSQL repositories: uses repository
- Checkout and orders → PostgreSQL repositories: uses repository
pkg/usecase/order.go - Checkout and orders → Shared services: uses shared services
pkg/usecase/order.go - Checkout and orders → Event publisher: publishes events
pkg/usecase/order.go - Event publisher → RabbitMQ: publishes messages
pkg/publisher/publisher.go - Database setup → PostgreSQL repositories: connects database
- Consumer bootstrap → Event consumer: starts consuming
notification-service/cmd/main.go - Consumer bootstrap → Notification repository: creates repository
notification-service/cmd/main.go - Consumer bootstrap → Email service: creates service
notification-service/cmd/main.go - Event consumer → RabbitMQ: consumes messages
- Event consumer → Notification repository: uses repository
notification-service/pkg/consumer/consumer.go - Event consumer → Email service: dispatches email
notification-service/pkg/consumer/consumer.go - Email service → Email provider: sends email