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

FilePurpose
src/config/site-config.tsAll site branding, URLs, metadata, store config
src/server/auth.tsNextAuth.js v5 configuration and exports
src/server/db/schema.tsDrizzle ORM database schema
src/payload.config.tsPayload CMS configuration
src/builder-registry.tsBuilder.io component registration
src/config/features-config.tsFeature flag detection from env vars
src/env.tsType-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