Skip to main content
HydroGo
CommerceCommerce Overview

Commerce Overview

How HydroGo models catalogs, carts, checkout, inventory reservation, and payment providers in a single compiled Go binary.

HydroGo's core commerce module handles catalogs, stock reservations, carts, idempotent checkout (idempotency_key in the JSON request body; outbound webhooks use the Idempotency-Key header), orders, and discount codes. Regional payment gateways, shipping carriers, e-invoicing, and SMS/WhatsApp providers plug in as commercial hydro-modules (-tags hydromodules).

Commerce is opt-in: activate it by adding commerce to the modules: list in config.yaml, or initialize a new project with hydro new mysite --preset commerce.

Catalog as Content Types

Unlike rigid legacy commerce platforms, products and variants in HydroGo are declarative YAML schemas in content-types/commerce/:

  • products.yaml: Main product attributes (title, slug, description, base price, categories).
  • variants.yaml: Color, size, SKU, barcode, and per-variant pricing overrides.
  • categories.yaml: Product groupings, hierarchical trees, and featured banners.
  • product_images.yaml: Gallery photos with focal point cropping and WebP optimization.

Commerce admin screens live under /admin/commerce* (while custom YAML collections live under /admin/content/<id>). Public read endpoints under /api/v1/content/products require public: true on the collection schema, or use /api/v1/commerce/*.

Transactional SQL Core

While the catalog is modeled as content types, operational transactional data lives in dedicated SQL tables optimized for ACID concurrency:

ComponentStorageConcurrency Guarantee
Catalog (Products, Categories)YAML + Content EngineCached edge reads, instant zero-build publish
Cart & Line ItemsSQL (commerce_carts, items)Session or anonymous cart cookie with atomic updates
Inventory & StockSQL (commerce_stock)Deterministic variant locking to reduce lock-order deadlocks (such as PostgreSQL 40P01)
Orders & PaymentsSQL (commerce_orders)Atomic ClaimCart serialization with idempotent retry keys
HydroGo serializes concurrent multi-tab checkout attempts via atomic cart claims, preventing duplicate orders or inventory race conditions.