Skip to content

Latest commit

 

History

History
67 lines (53 loc) · 2.64 KB

File metadata and controls

67 lines (53 loc) · 2.64 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Best Practices

  • always write code that is 'future-proof' meaning it should work when the application is scaled; it should work the same in a production environment just as it does locally
  • think about the big picture when fixing bugs; avoid using band-aid type fixes which tend to just mask issues

Commands

Development

  • npm run dev - Start development server with Turbopack
  • npm run build - Build for production
  • npm run start - Start production server

Code Quality

  • npm run lint - Run ESLint
  • npm run lint:fix - Run ESLint with auto-fix
  • npm run types - Run TypeScript type checking
  • npm run format:write - Format code with Prettier
  • npm run clean - Run both lint:fix and format:write

Database

  • npx drizzle-kit push - Push schema changes to database
  • npx drizzle-kit generate - Generate migration files
  • npx drizzle-kit migrate - Run migrations
  • npx bun db/seed - Seed database
  • npx supabase start - Start local Supabase instance

Testing

  • npm run test - Run all tests (unit + e2e)
  • npm run test:unit - Run Jest unit tests
  • npm run test:e2e - Run Playwright e2e tests

Shadcn UI Components

  • npx shadcn@latest add [component-name] - Install new Shadcn UI components

Architecture

This is a Next.js 15 SaaS template using the App Router with clear separation between authenticated and unauthenticated routes.

Route Structure

  • /app/(unauthenticated) - Public routes
    • (marketing) - Landing pages, pricing, features
    • (auth) - Login and signup flows
  • /app/(authenticated) - Protected routes requiring Clerk auth
    • dashboard - Main application with account, billing, support sections
  • /app/api - API routes including Stripe webhook handler

Key Patterns

  • Server Actions in /actions for data mutations (customers, Stripe operations)
  • Database Schema in /db/schema using Drizzle ORM with PostgreSQL
  • UI Components in /components/ui from Shadcn UI library
  • Authentication handled by Clerk middleware with protected route groups
  • Payments integrated via Stripe with webhook handling

Data Flow

  1. Authentication state managed by Clerk (@clerk/nextjs)
  2. Customer data stored in PostgreSQL via Drizzle ORM
  3. Stripe integration for subscription management
  4. Server actions handle all data mutations with proper auth checks

Environment Variables Required

  • NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY - Clerk public key
  • CLERK_SECRET_KEY - Clerk secret key
  • STRIPE_SECRET_KEY - Stripe secret key
  • Database connection handled by Supabase CLI