Organization
Organization protocol schemas
Organization Schema (Multi-Tenant Architecture)
Defines the standard organization/workspace model for ObjectStack.
Supports B2B SaaS scenarios where users belong to multiple teams/workspaces.
This aligns with better-auth's organization plugin capabilities.
Source: packages/spec/src/identity/organization.zod.ts
TypeScript Usage
import { Invitation, InvitationStatus, Member, Organization } from '@objectstack/spec/identity';
import type { Invitation, InvitationStatus, Member, Organization } from '@objectstack/spec/identity';
// Validate data
const result = Invitation.parse(data);Invitation
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| id | string | ✅ | Unique invitation identifier |
| organizationId | string | ✅ | Organization ID |
string | ✅ | Invitee email address | |
| role | string | ✅ | Role to assign upon acceptance |
| status | Enum<'pending' | 'accepted' | 'rejected' | 'expired'> | ✅ | Invitation status |
| expiresAt | string | ✅ | Invitation expiry timestamp |
| inviterId | string | ✅ | User ID of the inviter |
| createdAt | string | ✅ | Invitation creation timestamp |
| updatedAt | string | ✅ | Last update timestamp |
InvitationStatus
Allowed Values
pendingacceptedrejectedexpired
Member
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| id | string | ✅ | Unique member identifier |
| organizationId | string | ✅ | Organization ID |
| userId | string | ✅ | User ID |
| role | string | ✅ | Member role (e.g., owner, admin, member, guest) |
| createdAt | string | ✅ | Member creation timestamp |
| updatedAt | string | ✅ | Last update timestamp |
Organization
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| id | string | ✅ | Unique organization identifier |
| name | string | ✅ | Organization display name |
| slug | string | ✅ | Unique URL-friendly slug (lowercase alphanumeric, hyphens, underscores) |
| logo | string | optional | Organization logo URL |
| metadata | Record<string, any> | optional | Custom metadata |
| createdAt | string | ✅ | Organization creation timestamp |
| updatedAt | string | ✅ | Last update timestamp |