Project Structure
indiegoon follows a clear, predictable structure. Once you understand it, you'll always know where to find things and where to put new code.
Top-Level Overview
my-saas/
āāā src/ # All application code
ā āāā app/ # Next.js App Router (pages + API)
ā āāā components/ # React components
ā āāā config/ # App configuration
ā āāā lib/ # Core libraries (auth, db, payments, email)
āāā content/ # MDX content (blog posts)
āāā drizzle/ # Database migrations
āāā tests/ # E2E tests (Playwright)
āāā public/ # Static assets
āāā .goon/ # CLI manifest and AI rules
āāā .env # Environment variables (never commit)
āāā drizzle.config.ts # Database config
āāā next.config.ts # Next.js config (security headers)
āāā package.json # Dependencies and scripts
The src/app/ Directory
Next.js App Router uses file-based routing with route groups:
src/app/
āāā (app)/ # Authenticated pages (requires login)
ā āāā dashboard/ # Main dashboard
ā āāā billing/ # Subscription management
ā āāā settings/ # User settings
ā āāā teams/ # Team management
ā āāā admin/ # Admin panel (restricted)
ā āāā layout.tsx # App shell (sidebar + header)
ā
āāā (auth)/ # Auth pages (no chrome, centered layout)
ā āāā sign-in/
ā āāā sign-up/
ā āāā forgot-password/
ā āāā reset-password/
ā āāā verify-email/
ā āāā layout.tsx # Minimal auth layout
ā
āāā (marketing)/ # Public pages (navbar + footer)
ā āāā page.tsx # Landing page
ā āāā pricing/
ā āāā blog/
ā āāā changelog/
ā āāā privacy/
ā āāā terms/
ā āāā layout.tsx # Marketing layout
ā
āāā api/ # API routes
ā āāā auth/[...all]/ # Better Auth handler (catch-all)
ā āāā billing/ # Checkout, portal, invoices
ā āāā teams/ # Team CRUD + invitations
ā āāā webhooks/ # Payment webhooks
ā āāā lead/ # Email lead capture
ā āāā og/ # Dynamic OG image generation
ā
āāā layout.tsx # Root layout (fonts, metadata)
āāā globals.css # Design tokens + theme
āāā not-found.tsx # 404 page
The src/lib/ Directory
This is where the business logic lives:
src/lib/
āāā auth/
ā āāā index.ts # Better Auth server config
ā āāā client.ts # Client-side auth hooks
ā
āāā db/
ā āāā index.ts # Drizzle connection (Neon HTTP)
ā āāā schema/
ā āāā auth.ts # users, sessions, accounts, verifications
ā āāā subscriptions.ts # subscriptions table
ā āāā teams.ts # teams, members, invitations
ā āāā leads.ts # email leads
ā āāā index.ts # Barrel export
ā
āāā payments/
ā āāā index.ts # Provider factory (reads PAYMENT_PROVIDER env)
ā āāā types.ts # PaymentProvider interface
ā āāā sync.ts # Webhook ā database subscription sync
ā āāā providers/
ā āāā stripe.ts
ā āāā polar.ts
ā āāā lemon.ts
ā āāā dodo.ts
ā
āāā email/
ā āāā index.ts # Provider factory (reads EMAIL_PROVIDER env)
ā āāā types.ts # EmailProvider interface
ā āāā templates/
ā ā āāā auth.ts # Verify, reset, welcome, magic link emails
ā āāā providers/
ā āāā resend.ts
ā āāā postmark.ts
ā āāā sendgrid.ts
ā āāā mailgun.ts
ā āāā nodemailer.ts
ā
āāā teams/
ā āāā index.ts # Team CRUD, invitations, roles
ā
āāā admin/
ā āāā index.ts # Admin stats, user management
ā
āāā i18n/
ā āāā config.ts # Supported locales
ā āāā index.ts # Server-side translations
ā āāā client.tsx # React context + hooks
ā āāā locales/ # JSON translation files
ā
āāā seo/
ā āāā metadata.ts # buildMeta() helper
ā āāā structured-data.tsx # JSON-LD generators
ā
āāā blog.ts # MDX reader + frontmatter parser
āāā utils.ts # Shared utilities (cn, formatDate, etc.)
The src/components/ Directory
src/components/
āāā ui/ # Primitives (button, card, input, dialog...)
āāā layout/ # App shell (sidebar, header)
āāā sections/ # Marketing page sections (hero, pricing, FAQ...)
āāā blog/ # Blog components (MDX, code copy, callouts)
The .goon/ Directory
The CLI's brain. Tracks your project state:
{
"framework": "next",
"tier": "pro",
"database": "neon",
"features": ["blog", "admin"],
"providers": {
"payments": "stripe",
"email": "resend"
}
}
The goon CLI reads this to know what's installed, what tier you're on, and which providers you're using.
Key Design Principles
- ā¢
Provider-agnostic ā Payments and email use abstract interfaces. Swap providers by changing one env var. Zero code changes.
- ā¢
Route groups ā
(app),(auth), and(marketing)keep concerns separated. Each has its own layout. - ā¢
Colocation ā Related files live together. The billing page, billing actions, and billing API are all nearby.
- ā¢
Progressive disclosure ā Start simple. Add features as you need them via
goon add. - ā¢
AI-friendly ā
.goon/rules.mdandCLAUDE.mdgive AI agents the context to modify your project correctly.
Next Steps
- ā¢Authentication ā How the auth system works
- ā¢Database ā Schema, migrations, and queries
- ā¢CLI Reference ā All goon commands