Commerce Modules
Core modules that power Hanzo Commerce
Hanzo Commerce is composed of independent, composable modules. Each module owns a specific domain and exposes both a Go service API and REST endpoints.
Module Map
Product
Products, variants, options, images, and collections
Order
Order lifecycle, returns, exchanges, and status management
Cart
Shopping carts, line items, promotions, and tax calculation
Payment
Payment providers, authorization, capture, and refunds
Customer
Accounts, authentication, addresses, and customer groups
Fulfillment
Shipping profiles, zones, providers, and tracking
Inventory
Stock levels, reservations, locations, and multi-warehouse
Pricing
Price lists, volume tiers, rules, and currencies
Promotion
Coupons, discounts, campaigns, and automatic promotions
Tax
Tax regions, rates, providers, and automated calculation
Region
Multi-region support, currencies, and countries
Analytics
Events, dashboards, ClickHouse integration
Subscription
Recurring billing, plans, trials, and usage-based pricing
Module Structure
Every module follows the same internal pattern:
// module.go -- registration
type ProductModule struct {
service *ProductService
repository *ProductRepository
handler *ProductHandler
}
func NewProductModule(db *sql.DB, bus events.Bus) *ProductModule {
repo := NewProductRepository(db)
svc := NewProductService(repo, bus)
h := NewProductHandler(svc)
return &ProductModule{service: svc, repository: repo, handler: h}
}
func (m *ProductModule) RegisterRoutes(r chi.Router) {
r.Route("/product", func(r chi.Router) {
r.Get("/", m.handler.List)
r.Post("/", m.handler.Create)
r.Get("/{id}", m.handler.Get)
r.Patch("/{id}", m.handler.Update)
r.Delete("/{id}", m.handler.Delete)
})
}Events
Modules communicate through domain events:
| Event | Producer | Consumers |
|---|---|---|
product.created | Product | Search, Analytics |
order.confirmed | Order | Inventory, Fulfillment, Analytics |
payment.captured | Payment | Order, Analytics |
inventory.low | Inventory | Notification |
cart.abandoned | Cart | Analytics, Notification |
Configuration
Enable or disable modules in your commerce.yml:
modules:
product: true
order: true
cart: true
payment: true
customer: true
fulfillment: true
inventory: true
pricing: true
promotion: true
tax: true
region: true
analytics: true
subscription: false # opt-inHow is this guide?
Last updated on