OSS-first docs
These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.
Create a new order.
Goal
Allow buyers to purchase products.
Context
Checkout flow.
Emitted Events
•
`marketplace.order.created` (v1.0.0)
Source Definition
import { defineCommand } from '@lssm-tech/lib.contracts-spec/operations';
import {
CreateOrderInputModel,
OrderModel,
UpdateOrderStatusInputModel,
} from './order.schema';
export const CreateOrderContract = defineCommand({
meta: {
key: 'marketplace.order.create',
version: '1.0.0',
stability: 'stable',
owners: ['@example.marketplace'],
tags: ['marketplace', 'order', 'create'],
description: 'Create a new order.',
goal: 'Allow buyers to purchase products.',
context: 'Checkout flow.',
},
io: { input: CreateOrderInputModel, output: OrderModel },
policy: { auth: 'user' },
sideEffects: {
emits: [
{
key: 'marketplace.order.created',
version: '1.0.0',
when: 'Order is created',
payload: OrderModel,
},
],
audit: ['marketplace.order.created'],
},
acceptance: {
scenarios: [
{
key: 'create-order-happy-path',
given: ['User is authenticated'],
when: ['User creates order with valid items'],
then: ['Order is created', 'OrderCreated event is emitted'],
},
],
examples: [
{
key: 'create-basic-order',
input: {
storeId: 'store-123',
items: [{ productId: 'prod-456', quantity: 1, unitPrice: 100 }],
},
output: { id: 'order-789', status: 'pending', total: 100 },
},
],
},
});