| name | add-react-router-route |
| description | Add or modify a React Router route in the website app. Use this when asked to create a page, loader, action, or layout route. |
Follow this workflow when working on route creation or route restructuring in apps/website:
- Read
docs/technical-notes/README.md.
- Read
docs/technical-notes/routing.md.
- If the route is protected or touches login/session behavior, also read
docs/technical-notes/authentication.md.
- If the route is project-scoped, also read
docs/technical-notes/routes-access.md for the project access role middleware contract.
- If the route is user-facing, also read
docs/technical-notes/docs-pages.md to decide whether end-user docs must change.
Implementation checklist:
- Decide whether the route is public, an authenticated app page, a project-scoped page, or an authenticated API route.
- Create or update the route file under
apps/website/app/routes/.
- Wire the route into
apps/website/app/routes.ts. The repository does not use file-based discovery.
- Place the route under the right layout:
- non-project authenticated pages →
routes/app-layout.tsx
- members-only project pages →
routes/project-required-user-layout.tsx
- project pages readable on public projects →
routes/project-optional-user-layout.tsx
- authenticated API routes under
api/orgs/:orgSlug/... → routes/api-org-layout.tsx
- Reuse middleware-backed auth patterns:
- app pages use
userContext
- project-scoped pages additionally read
projectAccessRoleContext (set by projectMemberAccessMiddleware or projectOptionalAccessMiddleware) — do not recompute the role and do not hardcode ProjectAccessRole.MEMBER
- API routes use
orgContext
- Move database access, secrets, and provider SDK calls into
*.server.ts helpers when they do not belong directly in the route module.
- If the feature changes documented behavior, update the relevant MDX docs.
Validation checklist:
- Run the repository type-check command.
- Run the relevant tests for the touched surface, or the main test suite if no narrower test exists.