defineCommerce
A typed manifest builder that validates at definition time. Catch missing currencies, malformed prices, and duplicate offer IDs before they reach a route handler.
import { defineCommerce } from "steelyard";
// Validation runs at module load — bad input throws here, not at request time.
export const manifest = defineCommerce({
identity: {
name: "Acme Coffee",
domain: "acme.coffee",
currencies: ["USD"],
},
offers: [
{
id: "espresso",
title: "Single Espresso",
availability: "in_stock",
pricing: [{ kind: "one_time", amount: 300, currency: "USD" }],
},
{
id: "cappuccino",
title: "Cappuccino",
availability: "in_stock",
pricing: [{ kind: "one_time", amount: 500, currency: "USD" }],
},
],
});