Workspaces Module
Workspace CRUD and access control
The Workspaces module manages project containers within teams. Source: packages/server/src/modules/workspaces/.
REST Endpoints
All endpoints are prefixed with /api/v1/workspaces and require ClerkAuthGuard.
| Method | Path | Description |
|---|---|---|
| GET | /workspaces | List user's accessible workspaces |
| POST | /workspaces | Create a workspace |
| GET | /workspaces/:id | Get a single workspace |
| PATCH | /workspaces/:id | Update name or description |
| DELETE | /workspaces/:id | Delete workspace and its contents |
| POST | /workspaces/:id/move | Move workspace to a different team |
Query params for GET /workspaces:
| Param | Description |
|---|---|
teamId | Filter workspaces by team |
Workspace Service (services/workspaces.service.ts)
create(orgId, userId, dto)
Creates a new workspace. If no teamId is provided, the workspace is created in the user's personal team (auto-provisioned on first membership sync).
Input (CreateWorkspaceDto):
| Field | Required | Description |
|---|---|---|
name | Yes | Display name |
teamId | No | Target team (defaults to personal) |
description | No | Optional description |
A URL-safe slug is generated from the name (with deduplication if taken).
listForUser(orgId, userId, teamId?)
Returns all workspaces the user can access:
- Finds all teams where the user is a member.
- Returns all workspaces belonging to those teams (optionally filtered by
teamId).
getWorkspace(orgId, workspaceId, userId)
Returns a single workspace after verifying the user has access (is a member of the workspace's team). Throws 403 Forbidden if not a member.
updateWorkspace(orgId, workspaceId, userId, dto)
Updates name and/or description. Regenerates the slug if name changes. Access check: user must be a member of the workspace's team.
deleteWorkspace(orgId, workspaceId, userId)
Cascades deletion to all workspace resources: tasks, storage objects, artifact folders. Access check: user must be a member.
moveWorkspace(orgId, workspaceId, userId, targetTeamId)
Moves the workspace to a different team within the same org. Verifies the user is a member of both the source and target teams.
Workspace Schema
Workspaces are scoped under a
Team. There is noorgIdcolumn — the org is accessed viateam.orgId.
{
id: string;
teamId: string;
name: string;
slug: string;
description?: string;
archived: boolean;
createdBy: string; // userId of the creator
createdAt: Date;
updatedAt: Date;
}