> ## 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.

# Configuration

> All the knobs and levers you can turn — env vars, config files, and app settings

AnotherWrapper doesn't use one giant config file. Instead, configuration is spread across four layers — each with a clear purpose. Here's the full map.

<Tip>
  Don't try to configure everything on day one. Start with `pnpm bootstrap`, get the app running, then add features one at a time.
</Tip>

## The four config layers

<Tabs>
  <Tab title="Env Variables">
    `.env.example` is the source of truth. `pnpm bootstrap` generates a working `.env.local` from it.

    This is where you configure:

    * Auth (Better Auth secret, URLs)
    * Database (`DATABASE_URL`)
    * AI provider keys
    * Payments
    * Email
    * Analytics
    * Storage
    * Meta attribution
    * Sentry
  </Tab>

  <Tab title="Database Schema">
    Two surfaces to know:

    | What                   | Where             |
    | ---------------------- | ----------------- |
    | Schema source of truth | `lib/db/schema/*` |
    | Migration history      | `drizzle/*`       |

    Edit the schema files, then run `pnpm db:generate` to create a migration.
  </Tab>

  <Tab title="Site Config">
    `config.ts` defines global constants:

    * Site URLs and names
    * Support email
    * Route helpers
    * Marketing and app links

    This is where you rebrand the app.
  </Tab>

  <Tab title="App Tool Config">
    Each product app has a `toolConfig.ts` with:

    * App title and metadata
    * Credits cost
    * Default model
    * Tool path and description

    Edit these to customize individual apps.
  </Tab>
</Tabs>

## Env var reference

<AccordionGroup>
  <Accordion title="Core (required)">
    These are the bare minimum to run the app:

    ```env theme={null}
    NEXT_PUBLIC_APP_URL=http://localhost:3000
    BETTER_AUTH_SECRET=...
    DATABASE_URL=postgresql://...
    ```

    Plus at least one AI provider:

    <CodeGroup>
      ```env OpenAI theme={null}
      OPENAI_API_KEY=sk-...
      ```

      ```env Google AI theme={null}
      GOOGLE_GENERATIVE_AI_API_KEY=...
      ```

      ```env Anthropic theme={null}
      ANTHROPIC_API_KEY=sk-ant-...
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Auth">
    Email/password works with just `BETTER_AUTH_SECRET`.

    For magic links and forgot password, add:

    ```env theme={null}
    NEXT_PUBLIC_EMAIL_PROVIDER=resend
    EMAIL_PROVIDER=resend
    AUTH_EMAIL_FROM="YourApp <auth@yourdomain.com>"
    ```

    `NEXT_PUBLIC_EMAIL_PROVIDER` controls whether the auth UI shows magic-link and reset-password modes. `EMAIL_PROVIDER` is the server-side provider selection.

    For Google OAuth:

    ```env theme={null}
    GOOGLE_CLIENT_ID=...
    GOOGLE_CLIENT_SECRET=...
    NEXT_PUBLIC_GOOGLE_AUTH_ENABLED=true
    ```

    For Loops auth-email templates:

    ```env theme={null}
    LOOPS_AUTH_MAGIC_LINK_TRANSACTIONAL_ID=...
    LOOPS_AUTH_RESET_PASSWORD_TRANSACTIONAL_ID=...
    ```
  </Accordion>

  <Accordion title="Database">
    ```env theme={null}
    DATABASE_URL=postgresql://...
    ```

    Best practices:

    * Use `pnpm db:migrate` to apply schema changes
    * Use `pnpm db:generate` to create SQL after schema edits
    * Keep custom SQL migrations small and focused
  </Accordion>

  <Accordion title="AI Providers">
    You only need the providers you plan to use:

    ```env theme={null}
    OPENAI_API_KEY=...
    ANTHROPIC_API_KEY=...
    GOOGLE_GENERATIVE_AI_API_KEY=...
    GROQ_API_KEY=...
    XAI_API_KEY=...
    DEEPSEEK_API_KEY=...
    REPLICATE_API_TOKEN=...
    ELEVENLABS_API_TOKEN=...
    ```

    <Info>
      PDF RAG requires OpenAI for embeddings. Image/video generation often needs Replicate. Voice needs ElevenLabs.
    </Info>
  </Accordion>

  <Accordion title="Storage">
    Required for uploads, file-backed workflows, and generated assets:

    ```env theme={null}
    STORAGE_REGION=...
    STORAGE_ACCESS_KEY=...
    STORAGE_SECRET_KEY=...
    STORAGE_ENDPOINT=...
    STORAGE_BUCKET=...
    STORAGE_PUBLIC_URL=...
    ```

    Without storage, these features won't work: chat file upload, PDF flows, image/video/voice outputs, vision uploads.
  </Accordion>

  <Accordion title="Payments">
    ```env theme={null}
    NEXT_PUBLIC_PAYMENT_PROVIDER=stripe
    NEXT_PUBLIC_DEFAULT_MARKETING_PURCHASE_TYPE=plan-medium
    NEXT_PUBLIC_CHECKOUT_URL_TEMPLATE=...
    ```

    Plus the secret for your chosen provider:

    * `STRIPE_SECRET_KEY` + `STRIPE_WEBHOOK_SECRET`
    * `LEMON_SQUEEZY_WEBHOOK_SECRET`
    * `POLAR_WEBHOOK_SECRET`
  </Accordion>

  <Accordion title="Email">
    ```env theme={null}
    NEXT_PUBLIC_EMAIL_PROVIDER=none
    EMAIL_PROVIDER=none
    ```

    Switch to `loops`, `resend`, or `brevo` when you want auth emails or contact sync. Then add the matching key:

    * `LOOPS_API_KEY`
    * `RESEND_API_KEY`
    * `BREVO_API_KEY`

    And for auth emails: `AUTH_EMAIL_FROM` (required) and `AUTH_EMAIL_REPLY_TO` (optional).
  </Accordion>

  <Accordion title="Analytics">
    One or more providers, comma-separated:

    ```env theme={null}
    NEXT_PUBLIC_ANALYTICS_PROVIDER=posthog,datafast
    ```

    Then configure the specific provider env vars. See [Analytics](/services/analytics) for details.
  </Accordion>

  <Accordion title="Meta Attribution">
    Optional — only if you run Meta Ads:

    ```env theme={null}
    NEXT_PUBLIC_ENABLE_META_ATTRIBUTION=false
    NEXT_PUBLIC_META_PIXEL_ID=
    META_ACCESS_TOKEN=
    ```
  </Accordion>

  <Accordion title="Sentry">
    ```env theme={null}
    NEXT_PUBLIC_SENTRY_DSN=...
    ```

    Server-side overrides and tracing are optional.
  </Accordion>
</AccordionGroup>

## Recommended setup order

Don't try to fill every env var at once. Go in this order:

<Steps>
  <Step title="Run pnpm bootstrap">
    Let the wizard handle the initial setup.
  </Step>

  <Step title="Better Auth + DATABASE_URL">
    The absolute minimum to run the app.
  </Step>

  <Step title="One AI provider">
    OpenAI, Anthropic, or Google — just pick one to start.
  </Step>

  <Step title="Replicate (optional)">
    If you want image and video generation early.
  </Step>

  <Step title="Payment provider">
    When you're ready to charge money.
  </Step>

  <Step title="Email provider">
    When you want magic links, password resets, or contact sync.
  </Step>

  <Step title="Analytics">
    When you want to understand user behavior.
  </Step>

  <Step title="Extras">
    Meta attribution, Sentry, additional AI providers — add as needed.
  </Step>
</Steps>

<AccordionGroup>
  <Accordion title="Common mistakes to avoid">
    * Using `.env` instead of `.env.local`
    * Missing `BETTER_AUTH_SECRET`
    * Forgetting `DATABASE_URL`
    * Enabling email auth flows without `AUTH_EMAIL_FROM`
    * Enabling provider features without the matching API key
    * Expecting uploads to work without storage configured
    * Setting payment env vars but forgetting checkout URLs
    * Editing generated SQL by hand instead of updating `lib/db/schema/*`
    * Forgetting that `NEXT_PUBLIC_APP_URL` affects auth redirects
  </Accordion>
</AccordionGroup>

<CardGroup cols={3}>
  <Card title="Get Started" icon="play" href="/setup/introduction">
    Follow the setup guide first.
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/troubleshooting">
    Something not working? Check here.
  </Card>

  <Card title="Launch Checklist" icon="rocket" href="/launch-checklist">
    Ready to ship? Verify everything.
  </Card>
</CardGroup>
