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 organization.
Goal
Allow users to create new organizations/workspaces.
Context
Called during onboarding or when creating additional workspaces.
Emitted Events
•
`org.created` (v1.0.0)
Source Definition
import { defineCommand, defineQuery } from '@lssm-tech/lib.contracts-spec';
import { ScalarTypeEnum, SchemaModel } from '@lssm-tech/lib.schema';
import { SuccessResultModel } from './user';
export const CreateOrgContract = defineCommand({
meta: {
key: 'identity.org.create',
version: '1.0.0',
stability: 'stable',
owners: ['platform.identity-rbac'],
tags: ['identity', 'org', 'create'],
description: 'Create a new organization.',
goal: 'Allow users to create new organizations/workspaces.',
context: 'Called during onboarding or when creating additional workspaces.',
},
io: {
input: CreateOrgInputModel,
output: OrganizationModel,
errors: {
SLUG_EXISTS: {
description: 'An organization with this slug already exists',
http: 409,
gqlCode: 'SLUG_EXISTS',
when: 'Slug is already taken',
},
},
},
policy: {
auth: 'user',
},
sideEffects: {
emits: [
{
key: 'org.created',
version: '1.0.0',
when: 'Organization is created',
payload: OrganizationModel,
},
],
audit: ['org.created'],
},
});