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

# Monitoring

> Optional Sentry error tracking for production visibility

<Info>
  Monitoring helps you see production errors after your app is live. Sentry is optional in this repo and only turns on when you provide a DSN. If you skip it, the app works perfectly fine.
</Info>

## What Sentry Does for You

* See frontend and backend errors in one place
* Inspect full stack traces
* Track runtime problems after deployment
* Catch issues before your users report them (or don't report them)

## Get It Running

<Steps>
  <Step title="Create a Sentry project">
    Sign up at [sentry.io](https://sentry.io) and create a new project for your app.
  </Step>

  <Step title="Add the DSN">
    Copy your project DSN and add it to `.env.local`:

    ```env theme={null}
    NEXT_PUBLIC_SENTRY_DSN=https://example@o0.ingest.sentry.io/0
    ```

    You can also set the server-side DSN (falls back to `NEXT_PUBLIC_SENTRY_DSN` if missing):

    ```env theme={null}
    SENTRY_DSN=https://example@o0.ingest.sentry.io/0
    ```
  </Step>

  <Step title="Optional: Enable source maps">
    For nicer production stack traces, add these build-time variables:

    ```env theme={null}
    SENTRY_AUTH_TOKEN=your-auth-token
    SENTRY_ORG=your-org
    SENTRY_PROJECT=your-project
    ```
  </Step>

  <Step title="Optional: Tune runtime settings">
    Control the environment label and trace sampling:

    ```env theme={null}
    NEXT_PUBLIC_SENTRY_ENVIRONMENT=production
    SENTRY_ENVIRONMENT=production
    NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE=0.1
    SENTRY_TRACES_SAMPLE_RATE=0.1
    ```
  </Step>

  <Step title="Restart and trigger a test error">
    Restart the app (or redeploy in production) and trigger a test error to confirm Sentry receives it.
  </Step>
</Steps>

## Verify It Works

<Check>
  Your Sentry setup is working if:

  * The app still builds normally
  * Sentry initializes when a DSN is set
  * A test error appears in your Sentry project dashboard
</Check>

<AccordionGroup>
  <Accordion title="Added the DSN but no events show up">
    Did you restart the app or redeploy? Sentry won't initialize until the new env vars are loaded.
  </Accordion>

  <Accordion title="Stack traces are minified and unreadable">
    You need the source map env vars (`SENTRY_AUTH_TOKEN`, `SENTRY_ORG`, `SENTRY_PROJECT`) for readable production stack traces.
  </Accordion>

  <Accordion title="Events appear under the wrong project">
    Double-check that your DSN matches the correct Sentry project. Each project has a unique DSN.
  </Accordion>
</AccordionGroup>
