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 project in the organization.
Goal
Allow users to create projects for organizing work.
Context
Called from project creation UI or API.
Emitted Events
•
`project.created` (v1.0.0)
Source Definition
import {
defineCommand,
defineQuery,
} from '@lssm-tech/lib.contracts-spec/operations';
import {
CreateProjectInputModel,
DeleteProjectInputModel,
DeleteProjectOutputModel,
GetProjectInputModel,
ListProjectsInputModel,
ListProjectsOutputModel,
ProjectDeletedPayloadModel,
ProjectModel,
UpdateProjectInputModel,
} from './project.schema';
export const CreateProjectContract = defineCommand({
meta: {
key: 'saas.project.create',
version: '1.0.0',
stability: 'stable',
owners: ['example.saas-boilerplate'],
tags: ['saas', 'project', 'create'],
description: 'Create a new project in the organization.',
goal: 'Allow users to create projects for organizing work.',
context: 'Called from project creation UI or API.',
},
io: {
input: CreateProjectInputModel,
output: ProjectModel,
errors: {
SLUG_EXISTS: {
description: 'A project with this slug already exists',
http: 409,
gqlCode: 'SLUG_EXISTS',
when: 'Slug is already taken in the organization',
},
LIMIT_REACHED: {
description: 'Project limit reached for this plan',
http: 403,
gqlCode: 'LIMIT_REACHED',
when: 'Organization has reached project limit',
},
},
},
policy: {
auth: 'user',
},
sideEffects: {
emits: [
{
key: 'project.created',
version: '1.0.0',
when: 'Project is created',
payload: ProjectModel,
},
],
audit: ['project.created'],
},
acceptance: {
scenarios: [
{
key: 'create-project-happy-path',
given: ['User is authenticated'],
when: ['User creates project'],
then: ['Project is created', 'ProjectCreated event is emitted'],
},
],
examples: [
{
key: 'create-basic',
input: { name: 'Website Redesign', slug: 'website-redesign' },
output: { id: 'proj-123', name: 'Website Redesign', isArchived: false },
},
],
},
});