This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Start development server with debugging
pnpm dev
# Build for production
pnpm build
# Start production server
pnpm start
# Run tests
pnpm test # Run all tests
pnpm test:unit # Run unit tests only
pnpm test:e2e # Run E2E tests
pnpm test:e2e:serial # Run E2E tests serially
pnpm test:e2e:ui # Run E2E tests with UI
pnpm test:coverage # Run tests with coverage
# Code quality
pnpm format # Format code and fix linting
pnpm lint # Run linting
pnpm lint:fix # Fix linting issues
pnpm lint:strict # Run strict linting# Generate Prisma client
pnpm postinstall
# Database operations handled via Prisma CLI
# Database schema defined in prisma/schema.prisma- Frontend: Next.js 15 with App Router, React 19, TypeScript
- Styling: Tailwind CSS v4 with ShadCN/UI components
- State Management: Zustand stores
- Database: Prisma with PostgreSQL
- Authentication: NextAuth v5
- Testing: Vitest with Playwright E2E testing
This section outlines the primary directories and key files, grouped by functionality, to help navigate the codebase. It includes core services, state management, UI components, API routes, utilities, authentication, and configuration.
- `app/services/***
app/stores/- Zustand storesapp/interfaces/- TypeScript interfaces
app/components/- Reusable componentsapp/components/xxx/- xxx-specific componentsg
app/api/- Next.js API routes handling core functionalityapp/llms.txt/route.ts- Dynamic endpoint for LLM model catalog (SEO-friendly)
app/utils/- Shared utilitiesapp/lib/- Library functions for Prisma DB access (prisma.ts), auth helpers (auth-helpers.ts)app/lib/utils.ts- General-purpose utilities (e.g., cn() for classNames, toast notifications)
app/auth/- Authentication pages and flows (e.g.,verify-email/page.tsxfor email verification)lib/prisma.ts- Prisma client initialization and database connection pooling.env.local- Environment variablesprisma/schema.prisma- Database schema defining
test/- Test suites (unit intest/unit/, E2E with Playwright intest/e2e/, integration intest/integration/)docs/- Architecture docs, use cases, bug fixes, and implementation summaries (e.g.,docs/architecture-*.md)docs/ARCHI.md- Comprehensive technical architecture specification for NextJS Starter Kit applicationdocs/PRD.md- Product requirements document detailing the core problem and MVP features
- Use normalized entity-relation patterns for performance
- Always update both entities and relations together
- Follow the existing state update patterns for consistency
- Unit tests focus on services and utilities (
test/unit/) - E2E tests use Playwright for full workflow testing (
test/e2e/) - Integration tests combine service layer testing (
test/integration/)
- Optimized rendering with Zustand state selectors
- Context window management to prevent overflow
- "@/*" is link to @app
- "auth" is link to @auth
Then always use @ import insted of relative/absolute path
- Never use console.xxx but use use a managed logger => log.xxx (import { log } from '@/utils/logger';)
Cursor AI uses a rules system in .cursor/rules/ (.mdc files) to guide code generation and editing. These rules enforce project standards, best practices, and architecture patterns. Key rules (prioritized by importance) are summarized below; refer to the full files for detailed instructions.
000-agent.mdc: Defines agent behavior, tool usage, and response guidelines for Cursor interactions.core.mdc: Fundamental project rules, including mode switching, tool selection, and task decomposition.memory-bank.mdc: Memory management rules for context retention across sessions.
001-best-practise.mdc: General coding standards, error handling, performance tips, and security practices.100-naming-conventions.mdc: Naming rules for variables, functions, components, and files (e.g., camelCase for JS, PascalCase for components).103-readme.mdc: Guidelines for writing READMEs, documentation, and changelog entries.
101-client-components.mdc: Rules for React client components, hooks, and state management with Zustand.102-create-components.mdc: Patterns for creating new components, including ShadCN integration and accessibility.107-server-components.mdc: Next.js server components, data fetching, and SSR/SSG best practices.108-shadcn-ui.mdc: ShadCN/UI component usage, customization, and Tailwind integration.109-streaming-components.mdc: Streaming UI patterns for real-time AI responses, SSE handling, and LlmResponseRenderer.
104-nextjs-backend.mdc: API routes, server actions, authentication (NextAuth), and middleware rules.106-postgres.mdc: Prisma schema management, database migrations, queries, and PostgreSQL optimizations.
300-refactor-ref-react-19.mdc: Guidelines for refactoring to React 19 features, hooks updates, and compatibility.
Usage Note: When using Cursor, these rules are automatically applied. For Claude Code or other tools, adapt these patterns manually. If a rule file is missing or needs updates, check the .cursor/rules directory.