| applyTo | frontend/**/*, Taskfile.yml, compose.yaml |
|---|
- Keep all frontend logic within
frontend/. Do not import frombackend/. - Cross-repo changes are allowed only when required by the task or needed to keep
contracts/examples in sync:
- GraphQL schema/codegen outputs (e.g.,
task backend:schema:export/task frontend:codegen) .env.example/ README updates when frontend env vars or workflows change
- GraphQL schema/codegen outputs (e.g.,
- Framework: Next.js 16 (App Router).
- Runtime: Node.js 24.
- Styling: Tailwind CSS 4. Follow existing design tokens and utility patterns; avoid custom CSS unless necessary.
- Language: TypeScript with strict typing; avoid
any. - Package manager:
pnpm(workspace +pnpm-lock.yaml). Do not add packages without explicit permission. - Data fetching: Apollo Client (GraphQL). Use
src/lib/apolloClient.server.tsfor Server Components andsrc/lib/apolloClient.tsfor Client Components. - Linting/formatting: Biome; use
task frontend:checkfor fixes.
- Follow existing Next.js conventions and project structure.
- Avoid drive-by refactors; change only what the task requires.
src/app/: routes, layouts,loading.tsx,error.tsx.src/components/: reusable UI components.src/lib/: shared utilities, Apollo clients, GraphQL generated code.src/stories/: component documentation and story tests.
- Default to Server Components for data fetching and static content.
- Use
"use client"only when state/effects/browser APIs are required. - Place
"use client"at the very top of the file. - Keep Client Components as leaf nodes to maximize server rendering.
- Update the backend schema first when API changes are needed.
- After schema changes, run
task frontend:codegento update types and hooks. - Define
.graphqlfiles alongside components. - Use fragment masking via
useFragmentfromsrc/lib/graphql/; avoid passing large unmasked objects through props.
- Create stories for new UI components in
src/stories/or alongside the component. - Testing hierarchy:
- Unit/Component: Vitest (
task frontend:test:run). - Story tests:
task frontend:test:storybook. - E2E: Playwright (
task frontend:test:e2e).
- Unit/Component: Vitest (
- Implement
loading.tsxanderror.tsxfor robust UX.
Before declaring a frontend task complete:
- Run
task frontend:formatandtask frontend:check. - Ensure
task frontend:test:runandtask frontend:test:storybookpass. - If GraphQL was touched: ensure
task frontend:codegenwas run and no type errors exist. - Verify accessibility and responsive behavior.
- Check
.env.exampleif new environment variables were introduced.