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/
│ ├── cache/ # Cache provider interface
│ ├── cache-redis/ # Redis cache provider
│ ├── cache-upstash/ # Upstash Redis cache provider
│ ├── cache-cloudflare-kv/ # Cloudflare KV cache provider
│ ├── cron/ # Cron provider interface
│ ├── cron-qstash/ # QStash cron provider
│ ├── db-pg/ # PostgreSQL DB provider & Drizzle table definitions
│ ├── db-mysql/ # MySQL DB provider & Drizzle table definitions
│ ├── db-sqlite/ # SQLite DB provider & Drizzle table definitions
│ ├── email/ # Email provider interface
│ ├── email-resend/ # Resend email provider
│ ├── email-nodemailer/ # Nodemailer (SMTP) email provider
│ ├── newsletter/ # Newsletter provider interface
│ ├── newsletter-resend/ # Resend newsletter provider
│ ├── payment/ # Payment provider interface
│ ├── payment-stripe/ # Stripe payment provider
│ ├── payment-creem/ # Creem payment provider
│ ├── storage/ # Storage provider interface
│ └── storage-s3/ # S3-compatible storage provider
├── 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)
├── drizzle/ # Database migrations (committed to git)
├── 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/
├── layout/ # Layout components
│ ├── site-header.tsx
│ ├── site-footer.tsx
│ ├── app-sidebar.tsx
│ └── ...
├── landing/ # Landing page sections
├── blog/ # Blog components
└── shared/ # Shared componentsShared UI Package (packages/design-system/ui/)
packages/design-system/ui/
├── src/components/ # Shared source-vendored UI components
│ ├── auth/ # Better Auth UI source components
│ ├── settings/ # Better Auth settings source components
│ ├── ui/ # Canonical shadcn primitive source installed by the registry
│ └── user/ # Better Auth user menu/avatar source components
├── src/lib/utils.ts # Shared package `cn()` helper source
└── src/hooks/ # Hooks required by shared componentsShared Email Templates (packages/design-system/email-templates/)
packages/design-system/email-templates/
├── src/transactional-email.tsx # Shared transactional email layout
├── src/email-styles.tsx # Email-specific styles and colors
└── src/index.ts # `@launchsaas/email-templates` export entrypointThe app owns runtime global CSS in apps/launchsaas/src/app/globals.css. Shared UI components do not ship or import their own globals.css.
That file must also include @source "../../../../packages/design-system/ui/src"; so Tailwind scans the shared UI package and generates the utilities used by those components.
Server 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)
├── footer.ts # Footer links and badges
└── social-links.ts # Social media linksApp-owned runtime config lives in
apps/launchsaas/src/configuration/, and provider instances are wired inapps/launchsaas/src/capabilities.ts.
Libraries (src/lib/)
App-specific utilities:
src/lib/
├── auth/ # Better Auth server/client wiring
├── env/
│ ├── server.ts # Server-only environment variables
│ └── client.ts # Client-safe environment variables
├── session.ts # App-owned session policy and helpers
└── safe-action.ts # App-owned role/action wiringSchemas (src/schemas/)
App-specific Zod validation schemas.
Shared Packages
App Configuration (apps/launchsaas/src/configuration/)
apps/launchsaas/src/configuration/
├── metadata.ts # SEO / branding metadata
├── navbar.ts # Marketing navigation
├── sidebar.ts # Protected area sidebar
├── social-links.ts # Social links
├── user-button.tsx # User menu config
├── footer.ts # Footer config
├── types.ts # App-owned config types
└── product/ # App-owned payment product catalog and helpers
├── index.ts
├── products.ts
└── types.tsDatabase
Core provider package:
packages/databases/db-pg/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 exportsApp-owned binding and migration config:
apps/launchsaas/
├── src/db/index.ts # App binding to the selected provider package
├── drizzle.config.ts # App-owned Drizzle config
└── src/db/tables/ # App-specific extra tablesProvider Packages
Each provider package (email, payment, storage, newsletter, cache, cron) follows the same structure:
packages/capabilities/{name}/src/
├── provider.ts # Interface definition
└── index.ts # Public exports
packages/capabilities/{name}-{provider}/src/
├── provider.ts # Concrete provider implementation
├── keys.ts # Env var validation for this provider
└── index.ts # Public exportsContent Directory (apps/launchsaas/content/)
content/
├── blog/ # Blog posts (MDX)
├── docs/ # Documentation (MDX)
├── changelog/ # Changelog entries (MDX)
└── pages/ # Static pages (terms, privacy, license, etc.)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 |
apps/launchsaas/src/configuration/product/ | Pricing plans and products |
apps/launchsaas/src/capabilities.ts | Provider instance wiring |
apps/launchsaas/src/lib/auth/auth.ts | App-owned Better Auth server wiring |
apps/launchsaas/src/app/globals.css | Theme colors and global styles |
apps/launchsaas/content/docs/meta.json | Documentation sidebar order |