> ## Documentation Index
> Fetch the complete documentation index at: https://docs.collab-kit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Core Types

> User, Room, Organization, Comment, and Session types.

```typescript theme={null}
import type { CollabKitRole, CollabKitUser, CollabKitRoom, CollabKitOrganization, CollabKitComment, CollabKitUserSession } from '@collab-kit/utils';
```

## CollabKitRole

```typescript theme={null}
type CollabKitRole = 'editor' | 'viewer';
```

Roles are session-scoped. Editors are active collaborators and can write collaboration state. Viewers receive updates and can follow users, but cannot write stores, comments, presence, Yjs updates, storage, or broadcasts.

## CollabKitUser

Represents a user in a room.

```typescript theme={null}
interface CollabKitUser {
  id: string;
  room_id?: string;            // present in REST API responses, stripped from WebSocket responses
  name: string;
  profile_picture?: string;
  custom_id?: string;          // optional external identifier
  created_at?: string;         // present in REST API responses, stripped from WebSocket responses
  joined_at?: string;
  left_at?: string;
  status: 'online' | 'offline';
  token?: string;              // present only in the create-user REST API response
  following?: string[];
  followers?: string[];
}
```

> **Note:** `room_id`, `created_at`, and `token` are stripped from all WebSocket responses (broadcasts, join responses, user queries) for payload efficiency and security. They are still included in REST API responses (e.g., `GET /users/:id`, `POST /users`).

## CollabKitRoom

Represents a collaboration room.

```typescript theme={null}
interface CollabKitRoom {
  id: string;
  account_id: string;
  name: string;
  custom_id?: string;          // optional external identifier
  created_at: string;
  state: 'active' | 'disabled';
  duration_seconds: number;
  active_participants: number;
  total_users_created: number;
}
```

## CollabKitOrganization

Represents an organization (account).

```typescript theme={null}
interface CollabKitOrganization {
  id: string;
  user_id: string;
  email: string;
  name: string;
  description?: string;
  created_at: string;
  status: 'active' | 'disabled' | 'blocked';
}
```

## CollabKitClientOptions

Options passed to the `CollabKitClient` constructor.

```typescript theme={null}
interface CollabKitClientOptions<T extends StoresConfig = StoresConfig> {
  serverUrl: string;
  authToken: string;
  stores?: T;
}
```

## CollabKitComment

Represents a comment (top-level or reply).

```typescript theme={null}
interface CollabKitComment {
  id: string;
  userId: string;
  text: string;
  reactions: Record<string, string[]>;
  tags: string[];
  parentId: string | null;
  replies: CollabKitComment[];
  createdAt: string;
}
```

## CollabKitUserSession

A user's session record (join/leave timestamps).

```typescript theme={null}
interface CollabKitUserSession {
  id: string;
  user_id: string;
  room_id: string;
  joined_at: string;
  left_at?: string;
}
```
