File Structure
src/
├── app/ # Next.js App Router
│ ├── (app)/ # Main app routes (marketing, dashboard)
│ │ ├── (admin)/ # Admin-only routes (protected by layout)
│ │ ├── (dashboard)/ # User dashboard routes
│ │ ├── (integrations)/ # Integration routes (Stripe, Polar, Builder.io)
│ │ ├── landing/ # Landing page sections
│ │ └── webhooks/ # Webhook endpoints (LemonSqueezy, Stripe, Polar)
│ ├── (authentication)/ # Auth pages (sign-in, sign-out, error)
│ └── api/ # API routes
├── components/
│ ├── ui/ # 125+ shadcn/ui components
│ ├── primitives/ # Base building blocks (modal, link, error-boundary)
│ ├── blocks/ # Complex feature blocks (AI demos, sections)
│ ├── modules/ # Feature modules (auth, payments, onboarding, blog)
│ ├── layouts/ # Page layouts
│ ├── forms/ # Form components (contact, feedback, subscribe)
│ ├── headers/ # Header components
│ ├── footers/ # Footer components
│ └── providers/ # Context providers (auth, fonts, consent)
├── config/
│ ├── site-config.ts # Site name, URLs, branding, metadata
│ ├── features-config.ts # Build-time feature flag detection
│ ├── routes.ts # Route definitions
│ └── file.ts # File upload config
├── server/
│ ├── actions/ # Server actions (auth, payments, waitlist)
│ ├── services/ # Business logic (auth, payments, admin, RBAC)
│ ├── providers/ # Payment provider implementations
│ ├── db/ # Drizzle schema and database utilities
│ ├── auth.ts # NextAuth configuration
│ └── auth-js/ # Auth provider configs and utilities
├── lib/ # Shared utilities
│ ├── payload/ # Payload CMS collections, blocks, seed data
│ └── builder-io/ # Builder.io renderer
├── styles/ # Global CSS
├── types/ # TypeScript type definitions
└── workers/ # Web worker source files
Key Files
| File | Purpose |
|---|
src/config/site-config.ts | All site branding, URLs, metadata, store config |
src/server/auth.ts | NextAuth.js v5 configuration and exports |
src/server/db/schema.ts | Drizzle ORM database schema |
src/payload.config.ts | Payload CMS configuration |
src/builder-registry.ts | Builder.io component registration |
src/config/features-config.ts | Feature flag detection from env vars |
src/env.ts | Type-safe environment variable validation (T3 Env) |
Conventions
- kebab-case for file names
- PascalCase for component names
- Named exports everywhere (no default exports)
- Server Components by default,
'use client' only when needed
- Files should stay under 500 lines