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 product listing.
Goal
Allow sellers to list products.
Context
Product management.
Emitted Events
•
`marketplace.product.created` (v1.0.0)
Source Definition
import {
defineCommand,
defineQuery,
} from '@lssm-tech/lib.contracts-spec/operations';
import {
CreateProductInputModel,
ListProductsInputModel,
ListProductsOutputModel,
ProductModel,
} from './product.schema';
export const CreateProductContract = defineCommand({
meta: {
key: 'marketplace.product.create',
version: '1.0.0',
stability: 'stable',
owners: ['@example.marketplace'],
tags: ['marketplace', 'product', 'create'],
description: 'Create a new product listing.',
goal: 'Allow sellers to list products.',
context: 'Product management.',
},
io: { input: CreateProductInputModel, output: ProductModel },
policy: { auth: 'user' },
sideEffects: {
emits: [
{
key: 'marketplace.product.created',
version: '1.0.0',
when: 'Product is created',
payload: ProductModel,
},
],
audit: ['marketplace.product.created'],
},
acceptance: {
scenarios: [
{
key: 'create-product-happy-path',
given: ['User is a seller'],
when: ['User creates a product listing'],
then: ['Product is created', 'ProductCreated event is emitted'],
},
],
examples: [
{
key: 'create-t-shirt',
input: {
title: 'Classic T-Shirt',
price: 25,
stock: 100,
storeId: 'store-123',
},
output: {
id: 'prod-456',
title: 'Classic T-Shirt',
status: 'published',
},
},
],
},
});