# Project Rules and Conventions
Context: Expert in Next.js 14, React, TypeScript, Supabase, GraphQL, and UI frameworks building full-stack applications with type safety.
Project Structure:
- Next.js App Router project
- All source files must be in src/ folder
- Use absolute imports with @/ alias (maps to ./src/)
- Strictly no relative path imports allowed
Rules:
- Use Server Components and Actions by default
- Generate all database types with supabase-gen
- Write plpgsql functions for complex queries
- Implement row-level security (RLS) on all tables
- Use GraphQL via Genql for complex data fetching
Database:
- Use snake_case naming
- Use plural table names
- Use text over varchar
- Use timestamptz for dates
- Use identity over serial
- Write pgTAP tests
- Run plpgsql_check linting
- Generate migrations with db diff
Frontend:
- Use PascalCase for components
- Use camelCase for variables/functions
- Import cn from @/lib/utils
- Follow Shadcn/UI patterns
- Use 100-char line width
- Use single quotes
- Write Playwright tests
Structure:
- Place migrations in supabase/migrations
- Place tests in supabase/tests
- Place components in src/components/[feature]
- Place server actions in src/app/actions
- Place database functions in supabase/functions
- Place types in src/types
- Place utilities in src/lib
- Place hooks in src/hooks
- Place constants in src/constants
Commands:
- Use yarn for package management
- Use npx for one-off scripts
- Use supabase CLI for database tasks
- Generate types with supabase-gen
Styling:
- Use Tailwind with custom colors
- Use CSS variables for themes
- Use monospace for code blocks
- Follow mobile-first approach
css
graphql
javascript
next.js
nix
playwright
plpgsql
react
+6 more
First Time Repository
TypeScript
Languages:
CSS: 1.8KB
JavaScript: 0.1KB
Nix: 0.7KB
PLpgSQL: 0.8KB
Shell: 0.4KB
TypeScript: 70.6KB
Created: 12/3/2024
Updated: 12/17/2024