> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anotherwrapper.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Codebase Overview

> The big picture of how the repo is organized so you always edit the right layer

<Info>
  AnotherWrapper Premium is a **single Next.js app**, not a monorepo. This page helps you build a mental model of the codebase so you can find the right file quickly and avoid editing the wrong layer.
</Info>

## The Four Main Surfaces

Your app is organized around four key areas:

<CardGroup cols={2}>
  <Card title="Marketing Page" icon="megaphone" href="/setup/structure">
    `app/landing/` -- The public-facing landing page that sells your product.
  </Card>

  <Card title="Product Apps" icon="grid-2" href="/setup/structure">
    `app/(apps)/` -- The AI-powered apps your users interact with after signing in.
  </Card>

  <Card title="Dashboard" icon="house" href="/setup/structure">
    `app/page.tsx` -- The canonical home/dashboard route with account info, credits, and navigation.
  </Card>

  <Card title="API Routes" icon="server" href="/setup/structure">
    `app/api/` -- Shared backend routes for auth, avatars, OG images, and payment webhooks.
  </Card>
</CardGroup>

## Shared Layers

Everything that's reused across your app lives in these shared directories:

<AccordionGroup>
  <Accordion title="components/ -- Reusable UI">
    All your React components. Base primitives live in `components/ui/`, marketing components in `components/landing/`, and app-specific UI in `components/(apps)/`.
  </Accordion>

  <Accordion title="lib/ai/ -- AI & model logic">
    Model configuration, provider setup, and shared AI helpers. This is where you configure which models are available and how they behave.
  </Accordion>

  <Accordion title="lib/auth/ -- Authentication">
    Server-side auth helpers. The canonical entry point is `lib/auth/server.ts`.
  </Accordion>

  <Accordion title="lib/db/ -- Database access">
    Domain-first database modules. The Drizzle client, schema definitions, shared types, and feature-scoped queries all live here.
  </Accordion>

  <Accordion title="lib/actions/ -- Server actions">
    Server actions that sit above the database layer for form handling and orchestration.
  </Accordion>

  <Accordion title="lib/payments/ -- Billing">
    Provider-agnostic billing logic for Polar, Stripe, and LemonSqueezy.
  </Accordion>

  <Accordion title="lib/analytics/, lib/email/, lib/storage/, lib/rag/">
    Product analytics, contact sync, object storage, and document chunking/embeddings/retrieval.
  </Accordion>

  <Accordion title="lib/shared/, lib/integrations/, lib/config/, lib/observability/">
    Small cross-domain helpers, thin vendor SDK wrappers, static registries, and Sentry/monitoring.
  </Accordion>
</AccordionGroup>

## Where to Edit Common Things

<Tabs>
  <Tab title="Marketing Site">
    * `app/landing/page.tsx` -- The main landing page
    * `components/landing/*` -- Landing page components
    * `config.ts` -- Site-wide metadata and config
  </Tab>

  <Tab title="Product Apps">
    Each app has its own folder under `app/(apps)/`:

    * `app/(apps)/chat` -- AI chat
    * `app/(apps)/image-studio` -- Image generation
    * `app/(apps)/video-studio` -- Video generation
    * `app/(apps)/voice` -- Voice synthesis
    * `app/(apps)/audio` -- Audio processing
    * `app/(apps)/vision` -- Image analysis
    * `app/(apps)/marketing-plan` -- Marketing plan generator
    * `app/(apps)/launch-simulator` -- Launch simulator
  </Tab>

  <Tab title="Database">
    * `lib/db/schema/*` -- Schema source of truth
    * `lib/db/client.ts` -- Drizzle client
    * `lib/db/types/*` -- Shared database-derived types
    * `lib/db/<domain>/*` -- Feature-scoped queries and mutations
    * `lib/db/{cache,client-args,mutation,results}.ts` -- Small shared DB helpers
    * `drizzle/*` -- Generated and custom SQL migrations
    * `lib/actions/*` -- Server actions above the DB layer
  </Tab>

  <Tab title="Docs">
    * `docs/public/*` -- Public Mintlify docs (what you're reading now)
    * `docs/architecture/*` -- Internal architecture notes
  </Tab>
</Tabs>

## The Golden Rule

<Tip>
  When you want to change something, ask yourself three questions:

  1. **Is this marketing-only?** Edit `app/landing/` or `components/landing/`
  2. **Is this one app only?** Edit `app/(apps)/your-app/`
  3. **Is this shared across apps?** Edit `lib/`

  That question almost always tells you exactly where to go.
</Tip>
