This document provides guidelines for AI agents working in this repository.
- Do not generate or created sumary/resume files or similar.
- The project uses pnpm as package manager.
This is a Next.js application using TypeScript, Tailwind CSS, and Supabase for the backend. The goal is to build a financial dashboard.
- Run the development server:
npm run dev - Build the application:
npm run build - Run the linter:
npm run lint - Generate Supabase types:
npm run dbtypes
There are currently no tests in this project. When adding tests, please use Jest and React Testing Library.
- Run all tests:
npm test - Run a single test file:
npm test -- <path/to/test/file.spec.ts>
- Order:
- React and Next.js imports (
react,next/*) - External library imports (
@supabase/supabase-js,recharts) - Internal absolute imports from
@/(@/components/*,@/lib/*) - Relative imports (
../,./)
- React and Next.js imports (
- Alias: Use the
@/path alias for imports from thesrcdirectory.
- This project uses the default formatting from Prettier as configured in Next.js. Ensure you have a Prettier extension installed and configured in your editor.
- Use TypeScript for all new code.
- Generate Supabase types with
npm run dbtypesafter any schema changes. - Use the generated
database.types.tsfor all Supabase client interactions. - Define explicit types for function arguments and return values. Avoid
anyunless absolutely necessary.
- Components: PascalCase (
TransactionHistory.tsx) - Functions/Variables: camelCase (
calculateNetWorth) - Types/Interfaces: PascalCase (
Transaction,UserProfile) - Files: kebab-case for non-component files (
api-helpers.ts), PascalCase for components.
- Use
try...catchblocks for all asynchronous operations, especially for Supabase calls. - For data fetching with TanStack Query, use the
errorstate fromuseQuery. - Show user-friendly error messages or toasts on the UI when an operation fails.
- Use Zustand for global client-side state.
- Use TanStack Query for server state, caching, and data synchronization.
- Use Tailwind CSS for all styling.
- Use
clsxandtailwind-mergeto conditionally apply classes. - Create reusable component variants using
class-variance-authority.
- Use Next.js Route Handlers for API endpoints.
- All Supabase interactions on the server should use the server-side client from
@supabase/ssr.
- Do not commit secrets or environment variables. Use
.env.local. - Follow conventional commit message standards (e.g.,
feat:,fix:,refactor:). - Keep pull requests small and focused on a single feature or fix.