Project Structure
Understand the folder organization and architecture of LaunchSaaS
LaunchSaaS is a pnpm workspace monorepo with a Next.js app and shared packages.
Root Directory
.
├── apps/
│ └── launchsaas/ # Main Next.js application
├── packages/
│ ├── auth/ # Auth utilities & safe-action clients
│ ├── cache/ # Cache providers (Redis, Upstash, Cloudflare KV)
│ ├── config/ # Feature configuration & product config
│ ├── cron/ # Scheduled jobs (QStash)
│ ├── db/ # Database client & table schemas
│ ├── email/ # Email providers (Resend, Nodemailer)
│ ├── errors/ # Shared error definitions
│ ├── newsletter/ # Newsletter providers (Resend)
│ ├── payment/ # Payment providers (Stripe, Creem)
│ ├── storage/ # Storage providers (S3)
│ └── utils/ # Shared utilities
├── drizzle/ # Database migrations (committed to git)
├── biome.json # Lint + format configuration
├── pnpm-workspace.yaml # Workspace configuration
└── package.json # Root workspace scriptsApp Directory (apps/launchsaas/)
apps/launchsaas/
├── src/ # Application source code
├── content/ # MDX content (blog, docs, changelog)
├── public/ # Static assets
├── scripts/ # Utility scripts
├── .env # Environment variables (not in git)
├── package.json # App dependencies
└── next.config.mjs # Next.js configurationSource Directory (apps/launchsaas/src/)
App Router (src/app/)
src/app/
└── [locale]/
├── layout.tsx # Root locale layout
│
├── (marketing)/ # Public pages with header/footer layout
│ ├── layout.tsx
│ ├── blog/
│ ├── pricing/
│ └── ...
│
├── (protected)/ # Authenticated pages (require login)
│ ├── (common)/ # User-accessible features
│ │ ├── billing/
│ │ └── settings/
│ └── admin/ # Admin-only features
│ ├── users/
│ ├── orders/
│ └── entitlements/
│
├── auth/[path]/ # Better Auth dynamic routes
├── docs/[[...slug]]/ # Fumadocs documentation
└── api/ # API routesRoute Groups
(marketing)/- Public pages with marketing layout (header, footer)(protected)/(common)/- User-accessible auth-required pages(protected)/admin/- Admin-only pages
Components (src/components/)
src/components/
├── ui/ # shadcn/ui components (DO NOT edit directly)
├── layout/ # Layout components
│ ├── site-header.tsx
│ ├── site-footer.tsx
│ ├── app-sidebar.tsx
│ └── ...
├── landing/ # Landing page sections
├── blog/ # Blog components
├── shared/ # Shared components
└── email/ # Email templatesServer Actions (src/actions/)
Type-safe server actions organized by domain:
src/actions/
├── billing.ts # Payment and subscription actions
├── newsletter.ts # Newsletter subscription actions
├── storage.ts # File storage actions
└── user.ts # User management actionsApp-Level Configuration (src/configuration/)
UI and branding configuration:
src/configuration/
├── metadata.ts # Site name, title, description, SEO
├── navbar.ts # Navigation bar items and actions
├── sidebar.ts # Dashboard/Admin sidebar (role-based)
├── user-button.tsx # User dropdown menu (role-based)
├── fotoer.ts # Footer links and badges
└── social-links.ts # Social media linksFeature flags and product/pricing config live in
packages/config/src/— see below.
Libraries (src/lib/)
App-specific utilities:
src/lib/
├── auth/ # Better Auth instance configuration
├── env/
│ ├── server.ts # Server-only environment variables
│ └── client.ts # Client-safe environment variables
├── session.ts # Session helpers
└── safe-action.ts # Re-exports from @launchsaas/authSchemas (src/schemas/)
App-specific Zod validation schemas.
Shared Packages
Config (packages/config/src/)
packages/config/src/
├── features/ # Feature flags & provider selection
│ ├── index.ts # Selects production vs development config
│ ├── development.ts # Development feature config
│ └── production.ts # Production feature config
└── product/ # Pricing plans and products (per payment provider)
├── index.ts
├── development.ts
└── production.tsDatabase (packages/db/src/)
packages/db/src/
├── tables/ # Drizzle table definitions
│ ├── auth.ts # Auth tables (auto-generated, DO NOT edit)
│ ├── order.ts # Immutable payment records
│ ├── entitlement.ts # Mutable user access/subscription status
│ └── index.ts
├── db.ts # Database client
└── index.ts # Public exportsProvider Packages
Each provider package (email, payment, storage, newsletter, cache, cron) follows the same structure:
packages/{name}/src/
├── provider.ts # Interface definition
├── factory.ts # Provider factory
├── index.ts # Public exports
└── providers/
└── {provider-name}.tsContent Directory (apps/launchsaas/content/)
content/
├── blog/ # Blog posts (MDX)
├── docs/ # Documentation (MDX)
└── changelog/ # Changelog entries (MDX)Key Files
| File | Description |
|---|---|
apps/launchsaas/src/configuration/metadata.ts | Site name, title, description, logo |
apps/launchsaas/src/configuration/navbar.ts | Navigation with nested menus |
apps/launchsaas/src/configuration/sidebar.ts | Role-based sidebar for dashboard/admin |
packages/config/src/features/ | Feature flags and provider selection |
packages/config/src/product/ | Pricing plans and products |
apps/launchsaas/src/lib/auth/auth.ts | Better Auth configuration |
apps/launchsaas/src/app/globals.css | Theme colors and global styles |
apps/launchsaas/content/docs/meta.json | Documentation sidebar order |