xcladeDocs
Storefront GraphQL

Overview

Native Go 1.26 (gqlgen) Storefront & B2B GraphQL API — 53 Queries, 45 Mutations, 22 Commerce Domains

Storefront & B2B GraphQL (/graphql)

Every xclade store serves a strongly-typed, code-generated Go 1.26 (gqlgen) GraphQL endpoint at:

POST https://{shortId}.api.myxclade.com/graphql

Unlike legacy Node.js wrappers, the GraphQL execution layer compiles directly into your store's Go binary—delivering low memory overhead, concurrent field execution, per-request Go DataLoader batching, and predictable sub-50ms p95 latency.


Core Capabilities

CapabilityImplementation
Schema Coverage22 domain schema files, 53 Queries, and 45 Mutations spanning DTC catalog, contextual pricing, carts, checkout, ID Rabbit verification, passwordless OTP, orders, returns, reviews, and full B2B wholesale.
Runtime EngineNative Go 1.26 + github.com/99designs/gqlgen + chi/v5 + pgx/v5 + go-redis/v9.
N+1 PreventionPer-request Go DataLoader batching (graph/loaders/) for collections, categories, product types, currencies, regions, countries, and order items.
Response CachingBuilt-in XcladeResponseCache caches 17 allowlisted public queries in Redis, isolated by tenant scope, publishable key sales channels, locale, and actor—with automatic gql:public tag invalidation on mutations.
Persisted QueriesAutomatic Persisted Queries (APQ) backed by an LRU hash cache (512 entries) plus a 1,000-entry parsed AST cache.
Security HardeningBuilt-in XcladeGraphQLArmor enforcing AST depth, alias, directive, batch, payload size, execution timeout, CSRF GET preflight, and Redis sliding-window rate limits.

Dual GraphQL Surfaces

Every store pod exposes two cleanly separated GraphQL endpoints:

  • POST /graphql — Storefront, customer accounts, and B2B buyer workflows (documented in this section).
  • POST /admin/graphql — Back-office operations, RBAC, WMS bins/cycle counts, analytics, and batch imports (see Merchant Admin GraphQL).

Minimal Example

curl -X POST https://{shortId}.api.myxclade.com/graphql \
  -H "Content-Type: application/json" \
  -H "X-Xclade-Publishable-Key: pk_live_..." \
  -H "X-Xclade-Request: true" \
  -d '{
    "query": "query Catalog($currency: String!) { products(limit: 4, pricing_context: { currency_code: $currency }) { products { id title handle variants { id sku inventory_quantity calculated_price { calculated_amount currency_code } } } count } }",
    "variables": { "currency": "usd" }
  }'

Next Steps

On this page