Project Structure

Understand the folder organization and architecture of LaunchSaaS

Project Structure

LaunchSaaS follows Next.js App Router conventions with a well-organized structure for scalability and maintainability.

Root Directory

.
├── src/                  # Application source code
├── content/              # MDX content (blog, docs, changelog)
├── public/               # Static assets
├── scripts/              # Utility scripts
├── drizzle/              # Database migrations
├── .env                  # Environment variables (not in git)
├── package.json          # Dependencies and scripts
└── next.config.mjs       # Next.js configuration

Source Directory

App Router (src/app/)

src/app/
├── layout.tsx            # Root layout
├── page.tsx              # Homepage
├── globals.css           # Global styles

├── (marketing)/          # Public marketing pages
│   ├── layout.tsx        # Marketing layout with header/footer
│   ├── blog/             # Blog pages
│   ├── pricing/          # Pricing page
│   └── ...               # Other marketing pages

├── (protected)/          # Protected routes (require auth)
│   ├── layout.tsx        # Shared layout with sidebar
│   ├── loading.tsx       # Loading skeleton
│   ├── dashboard/        # User dashboard
│   └── admin/            # Admin panel

├── auth/[path]/          # Authentication pages
├── docs/                 # Documentation site
└── api/                  # API routes

Route Groups

  • (marketing)/ - Public pages with marketing layout (header, footer)
  • (protected)/ - Authenticated pages with shared sidebar layout

Components (src/components/)

src/components/
├── ui/                   # Base UI components (shadcn/ui)
├── layout/               # Layout components
│   ├── site-header.tsx   # Marketing header with nested nav
│   ├── site-footer.tsx   # Marketing footer
│   ├── app-sidebar.tsx   # Dashboard/Admin sidebar
│   ├── user-menu-button.tsx # User dropdown with role-based menu
│   ├── dynamic-breadcrumb.tsx # Auto-generated breadcrumb
│   └── ...
├── landing/              # Landing page sections
├── blog/                 # Blog components
├── shared/               # Shared components
└── email-templates/      # Email templates

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 actions

Configuration (src/configuration/)

Modular configuration files for easy customization:

src/configuration/
├── index.ts              # Central exports
├── 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 links
└── product.ts            # Pricing and product configuration

Libraries (src/lib/)

Core utilities and integrations:

src/lib/
├── db.ts                 # Database client
├── auth/                 # Better Auth configuration
├── stripe.ts             # Stripe client
├── email.ts              # Email sending
├── safe-action.ts        # Type-safe server actions
├── session.ts            # Session helpers
└── ...                   # Other utilities

Schemas (src/schemas/)

src/schemas/
├── site-configuration.ts # Configuration type definitions
├── tables/               # Database table definitions
│   ├── auth.ts           # Auth tables (auto-generated)
│   ├── payment.ts        # Payment tables
│   └── index.ts          # Re-exports
└── ...                   # Zod validation schemas

Environment (src/env/)

src/env/
├── server.ts             # Server-only environment variables
└── client.ts             # Client-safe environment variables

Content Directory

content/
├── blog/                 # Blog posts (MDX)
├── docs/                 # Documentation (MDX)
└── changelog/            # Changelog entries (MDX)

Key Files

FileDescription
src/configuration/metadata.tsSite name, title, description, logo
src/configuration/navbar.tsNavigation with nested menus
src/configuration/sidebar.tsRole-based sidebar for dashboard/admin
src/configuration/product.tsPricing plans and products
src/lib/auth/auth.tsBetter Auth configuration
src/app/globals.cssTheme colors and global styles
content/docs/meta.jsonDocumentation sidebar order

Next Steps