# Projects (/en/docs/projects)

- [Create a Project](#create-and-manage-a-project)

- [Extend the domain](#follow-a-project-change)

- [Verify locally](#verify-the-local-path)

Projects is the included, persisted application domain you can build on after
signing in.

Every Project belongs to one Organization; your private **Personal** Organization
owns the Projects you make by default. The server checks your membership on every
request.

**Give your agent this prompt:**

```text interactive=true
Add <field or behavior> to Projects while preserving Organization authorization and data scope.
Follow https://coremvp.com/en/docs/projects.md; ask me before removing tables or data.
Finish when ./coremvp e2e projects passes and a focused UI or API check proves the requested change persists or behaves as intended.
Report the changes, the test result, and anything you could not run.
```

## Create and manage a Project

Start the app as in the [Quickstart](/en/docs/quickstart), then
sign in with a non-anonymous account. On a clean installation,
`bunx supabase start` applies the normal migrations, including Organizations
and Projects. If an older custom `public.projects` table already exists, the
migration stops rather than adopting or deleting it; resolve that collision
before continuing.

1. In the dashboard, select **Personal** or a shared Organization, then open
   **Projects** from the sidebar.
2. Choose **New project**, enter a **Project name**, and select
   **Create Project**. The new Project opens at `/dashboard/projects/[projectId]`.
3. Change **Project name** and select **Save name**, or select
   **Archive Project**. Open the **Archived** filter and select
   **Restore Project** to make it active again. An archived Project cannot be
   renamed until it is restored.

The Project ID, not its display name, identifies the row. Two Projects can have
the same name. Archive is reversible; there is no hard-delete action.

## Who can access a Project?

| Organization role | Project access                         |
| ----------------- | -------------------------------------- |
| Owner             | View, create, rename, archive, restore |
| Admin             | View, create, rename, archive, restore |
| Member            | View only                              |
| Nonmember         | No access                              |

The owner sets `admin` or `member` on the Organization members screen. Those
roles apply to **every** Project in that Organization; there is no `viewer` role
or per-Project grant. A Personal Organization cannot invite another member.
For shared access, use the [Organization invitation and role
flow](/en/docs/organizations/members-and-permissions)—not a Project invite.

The service verifies the Supabase Auth user and reloads the Organization role;
the repository scopes the write to both `organization_id` and the Project ID. A
selected Organization in the browser is presentation state, not permission. The
public demo shows fixed sample Projects and does not save them.

## Follow a Project change

The live screen in `src/components/projects/live-projects.tsx` connects the
shared UI in `src/components/projects/project-pages.tsx` to the hooks in
`src/hooks/projects/use-projects.ts`. The hooks call `/api/projects` on the
same origin; the native adapter passes the request to Hono. Follow the existing
caller into the layer that owns your change:

| Change                                                                   | Edit                                                                               |
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------- |
| Stored Project fields (ID, Organization, name, timestamps, archive time) | `supabase/migrations/` and `src/lib/db/models/projects.ts`                         |
| Persisted reads or writes                                                | `src/lib/db/repositories/project.repository.ts`                                    |
| Product rules, permissions or lifecycle                                  | `src/services/projects/service.ts` and `src/services/organizations/permissions.ts` |
| HTTP input or response                                                   | `src/api/routes/projects.ts`                                                       |
| Browser requests and caching                                             | `src/hooks/projects/use-projects.ts`                                               |
| Screen presentation                                                      | `src/components/projects/project-pages.tsx`                                        |

The Project routes are the only framework-specific files:

| Page         | Next.js                                           | TanStack Start                                 |
| ------------ | ------------------------------------------------- | ---------------------------------------------- |
| Project list | `src/app/dashboard/projects/page.tsx`             | `src/routes/dashboard/projects/index.tsx`      |
| One Project  | `src/app/dashboard/projects/[projectId]/page.tsx` | `src/routes/dashboard/projects/$projectId.tsx` |

For a new page or URL, add a route beside these and reuse the existing
components and hooks; [Add a dashboard page](/en/docs/frontend/customize-dashboard#add-a-dashboard-page)
shows the steps. Keep authorization in the service: a visible button or
browser-supplied identity does not grant access.

To add a Project field, follow the worked `description` example in order. Do not
recreate `public.projects`.

1. [Change Database Schema](/en/docs/database/change-schema)
2. [Query Application Data](/en/docs/database/query-data)
3. [Add Business Logic](/en/docs/backend/add-business-logic)
4. [Create API Endpoint](/en/docs/backend/create-api-endpoint#accept-the-new-field)
5. [Fetch and Update Data](/en/docs/frontend/fetch-update-data#show-the-new-field-in-the-dashboard)

## Verify the local path

With local Supabase and the app running, run this from the application repository
root:

```bash
./coremvp e2e projects
```

_Video: The Projects check in a browser, sped up: the owner signs in, creates, finds, renames and archives Projects in the dashboard (/docs/projects/test-projects.mp4)._

The clip shows the owner's browser from one passing local run, at 2.5× speed.

The command should exit successfully. The Projects suite checks the browser and API lifecycle,
cross-account denial, direct Data API denial, the sample-only demo and the
custom-table migration collision. For an extension, also check through the UI or
API that the requested behavior works and any new value persists after reload.
Run `./coremvp e2e organizations` when you
change shared membership or role behavior.

## Keep, hide, or remove the included domain

Keep the automatically created **Personal** Organization and do not create
another one; its Projects remain private to its owner. You do not need a shared
workspace to use the ownership model.

**Hide Projects.** Remove the sidebar entry and routes and leave the schema in place. Auth and the
private ownership boundary keep working.

**Remove Projects.** There is no runtime feature flag that uninstalls the Organizations and Projects
domains. The migration, signup trigger, dashboard and demo compositions, API,
services, repositories, models and tests share one contract.

### 1. Remove the consumers together

In a new project, before applying `20260917080347_projects.sql` in
`supabase/migrations/`, remove every consumer of the domain. Use TypeScript, a clean local database
reset and the Auth checks to confirm nothing still depends on it.

### 2. Clean up an installation that already has the tables

Do not delete an already-applied migration; it does not remove deployed
tables or data. Export anything you need, then create a new forward
migration for the exact destructive cleanup your product requires.
