All Docs

Project Structure

Understand how the ShipKit codebase is organized.

Overview

ShipKit follows a modular architecture with clear separation of concerns. Here's the high-level directory structure:

shipkit/
├── prisma/              # Database schema, migrations, seeds
├── public/              # Static assets
├── src/
│   ├── app/             # Next.js App Router pages & API routes
│   │   ├── (auth)/      # Authentication pages
│   │   ├── (dashboard)/ # User dashboard pages
│   │   ├── (marketing)/ # Public marketing pages
│   │   ├── admin/       # Admin dashboard pages
│   │   └── api/         # API route handlers (248+ endpoints)
│   ├── components/      # React components (73+ categories)
│   │   ├── ui/          # Base UI components (shadcn/ui)
│   │   ├── forms/       # Form components
│   │   ├── dashboard/   # Dashboard-specific components
│   │   └── marketing/   # Marketing page components
│   ├── hooks/           # Custom React hooks
│   ├── lib/             # Core utilities & configurations
│   │   ├── auth/        # Authentication helpers
│   │   ├── billing/     # Stripe & LemonSqueezy
│   │   ├── cache/       # Redis caching layer
│   │   ├── email/       # Email providers & templates
│   │   ├── db/          # Database utilities
│   │   └── ...
│   ├── services/        # Business logic layer (32+ modules)
│   ├── store/           # Redux Toolkit store & slices
│   └── types/           # TypeScript type definitions
├── scripts/             # Utility scripts (17+)
└── content/             # MDX content (blog, docs, changelog)

Key Directories

/src/app/api/

All 248+ API endpoints organized by resource:

  • /api/v1/auth/ — Authentication endpoints
  • /api/v1/orgs/ — Organization management
  • /api/v1/billing/ — Stripe billing
  • /api/v1/campaigns/ — Email campaigns
  • /api/v1/webhooks/ — Webhook management
  • And many more...

/src/services/

Business logic is separated from route handlers into service modules. Each service handles a specific domain (users, organizations, billing, etc.) and can be reused across multiple endpoints.

/src/lib/

Core utilities including database connections, caching layers, email providers, authentication helpers, and shared configuration.

Architecture Principles

  1. Service Layer Pattern: Route handlers delegate to services for business logic
  2. Repository Pattern: Database access through Prisma with typed queries
  3. Middleware Chain: Authentication, rate limiting, and validation as middleware
  4. Event-Driven: Webhook events trigger side effects (notifications, logs, etc.)