Hanzo
CommerceDeployment

Deployment

Deploy Hanzo Commerce to production with best practices

Hanzo Commerce can be deployed in multiple ways depending on your infrastructure requirements, team size, and scaling needs.

Deployment Options

Infrastructure Requirements

Minimum (Development / Small Store)

ComponentRequirement
CPU2 cores
RAM4 GB
Disk20 GB SSD
NetworkPublic IP or reverse proxy
ComponentRequirement
CPU4+ cores
RAM8+ GB
Disk100 GB SSD
DatabasePostgreSQL 15+ (managed recommended)
CacheRedis 7+
SearchMeilisearch or PostgreSQL FTS
Object StorageS3-compatible (Hanzo S3, AWS S3, R2)

Environment Variables

All deployment methods share these core environment variables:

# Required
COMMERCE_DIR=/data                    # Data directory
DATABASE_URL=postgresql://...         # PostgreSQL connection string
HANZO_API_KEY=hk_live_...            # Hanzo platform API key

# Cache and Sessions
KV_URL=redis://redis:6379/0          # Redis connection URL

# Object Storage (uploads, media)
S3_URL=s3://key:secret@host/bucket   # S3-compatible storage URL

# Search (optional but recommended)
SEARCH_URL=http://meilisearch:7700   # Meilisearch URL

# Payments
STRIPE_SECRET_KEY=sk_live_...        # Stripe secret key
STRIPE_WEBHOOK_SECRET=whsec_...      # Stripe webhook signing secret

# Authentication
HANZO_CLIENT_ID=...                  # OAuth2 client ID
HANZO_CLIENT_SECRET=...              # OAuth2 client secret

# Analytics (optional)
CLICKHOUSE_URL=http://...:8123       # ClickHouse for analytics

# Server
COMMERCE_PORT=8090                   # HTTP listen port (default: 8090)
COMMERCE_HOST=0.0.0.0               # Bind address
COMMERCE_ENV=production              # Environment (development|production)

Health Checks

Commerce exposes health endpoints for orchestration and monitoring:

EndpointPurpose
GET /healthBasic liveness check -- returns 200 if the process is running
GET /health/readyReadiness check -- returns 200 when all dependencies (DB, Redis) are connected
GET /health/startupStartup probe -- returns 200 after initial migrations and warming

Example health check response:

{
  "status": "healthy",
  "version": "1.4.2",
  "uptime": "72h14m",
  "checks": {
    "database": "ok",
    "redis": "ok",
    "search": "ok",
    "storage": "ok"
  }
}

Monitoring

Prometheus Metrics

Commerce exposes metrics at /metrics in Prometheus format:

  • commerce_http_requests_total -- request count by method, path, status
  • commerce_http_request_duration_seconds -- request latency histogram
  • commerce_orders_total -- order count by status
  • commerce_active_carts -- current active cart gauge

Structured Logging

Commerce logs in JSON format to stdout:

{"level":"info","ts":"2026-02-16T10:00:00Z","msg":"order.created","orderId":"order_abc123","total":5998}

Set the log level with COMMERCE_LOG_LEVEL (debug, info, warn, error).

Next Steps

Choose your deployment method from the options above, or start with Docker for the fastest path to production.

How is this guide?

Last updated on

On this page