|
2 | 2 |
|
3 | 3 | A Project groups environments. An environment is an existing `workspace` record; there is no separate environment table. Every newly created Project starts with an environment. |
4 | 4 |
|
| 5 | +Project APIs return HTTP 503 until the deployment enables `PROJECT_API_ENABLED`. Automatic assignment on legacy workspace creation requires `PROJECT_WRITES_ENABLED`; both server controls default off. The API requires writers to be enabled. Existing assigned Projects always retain their lifecycle protections, including fork inheritance and disconnect behavior, even if activation is disabled. |
| 6 | + |
5 | 7 | ## Choose the creation flow |
6 | 8 |
|
7 | 9 | | Caller | Flow | Result | |
8 | 10 | | --- | --- | --- | |
9 | 11 | | New Project onboarding | `POST /api/projects` | Creates a Project and its first environment together, with independently supplied names. | |
10 | | -| Existing workspace creation UI or caller | `POST /api/workspaces` | Creates a workspace and automatically creates its Project, preserving the existing workspace response. | |
11 | | -| Create another environment by forking | Existing workspace fork operation | Creates a child workspace in the source workspace's Project. | |
| 12 | +| Existing workspace creation UI or caller | `POST /api/workspaces` | Creates a workspace and, when Project writers are enabled, automatically creates its Project, preserving the existing workspace response. | |
| 13 | +| Create another environment by forking | Existing workspace fork operation | Inherits the source workspace's Project; unassigned legacy families remain unassigned until backfilled. | |
12 | 14 |
|
13 | 15 | Both POST endpoints are internal, session-authenticated APIs. `POST /api/projects` is not a public `/api/v2` endpoint and does not accept API-key principals. This foundation does not remove or deprecate existing workspace creation endpoints. |
14 | 16 |
|
@@ -67,10 +69,10 @@ Existing callers can continue to use `createWorkspaceContract` and `POST /api/wo |
67 | 69 |
|
68 | 70 | `skipDefaultWorkflow` remains optional and defaults to `false`. The route uses the session's active organization and existing workspace creation policy to resolve ownership and billing. It does not take the explicit Project scope or independent Project name used by `POST /api/projects`. |
69 | 71 |
|
70 | | -The workspace and its Project are still created atomically. The generated Project name is `Support workspace - Project`; long names are bounded to 100 characters while retaining the suffix. The response remains `{ "workspace": ... }` with HTTP 200, without a new Project response wrapper. Call `GET /api/projects/by-workspace/[workspaceId]` when an existing workspace caller needs its authorized Project details. |
| 72 | +When Project writers are enabled, the workspace and its Project are created atomically. The generated Project name is `Support workspace - Project`; long names are bounded to 100 characters while retaining the suffix. The response remains `{ "workspace": ... }` with HTTP 200, without a new Project response wrapper. Call `GET /api/projects/by-workspace/[workspaceId]` when an existing workspace caller needs its authorized Project details. |
71 | 73 |
|
72 | 74 | ## Server implementation |
73 | 75 |
|
74 | 76 | The Project route calls `createProject` in `application/create-project.ts`. Existing workspace callers continue through their current creation paths. Both use the shared transaction primitive in `lib/workspaces/create.ts`; surface adapters must not independently commit Project and workspace creation. |
75 | 77 |
|
76 | | -Project descriptions and Project-scoped files are not part of this creation contract. Project-scoped files and a designated Project brief are follow-up work documented in the foundation plan. |
| 78 | +Project descriptions and Project-scoped files are not part of this creation contract. Project-scoped files and a designated Project brief are follow-up work. |
0 commit comments