This file provides guidance to Claude Code when working with code in this repository. ## Core Technologies - **Next.js 15** with App Router - **Supabase** for database, auth, and storage - **React 19** - **TypeScript** - **Tailwind CSS 4** and Shadcn UI - **Turborepo** ## Monorepo Structure - `apps/web` - Main Next.js SaaS application - `apps/e2e` - Playwright end-to-end tests - `packages/features/*` - Feature packages - `packages/` - Shared packages and utilities - `tooling/` - Build tools and development scripts ## Multi-Tenant Architecture **Personal Accounts**: Individual user accounts (auth.users.id = accounts.id) **Team Accounts**: Shared workspaces with members, roles, and permissions Data associates with accounts via foreign keys for proper access control. ## Essential Commands ### Development Workflow ```bash pnpm dev # Start all apps pnpm --filter web dev # Main app (port 3000) ``` ### Database Operations ```bash pnpm supabase:web:start # Start Supabase locally pnpm supabase:web:reset # Reset with latest schema pnpm supabase:web:typegen # Generate TypeScript types pnpm --filter web supabase:db:diff # Create migration ``` ### Code Quality ```bash pnpm format:fix pnpm lint:fix pnpm typecheck ``` - Run the typecheck command regularly to ensure your code is type-safe. - Run the linter and the formatter when your task is complete. ## Typescript - Write clean, clear, well-designed, explicit TypeScript - Avoid obvious comments - Avoid unnecessary complexity or overly abstract code - Always use implicit type inference, unless impossible - You must avoid using `any` - Handle errors gracefully using try/catch and appropriate error types ## React - Use functional components - Always use 'use client' directive for client components - Add `data-test` for E2E tests where appropriate - `useEffect` is a code smell and must be justified - avoid if possible - Do not write many separate `useState`, prefer single state object (unless required) - Prefer server-side data fetching using RSC