Skip to main content

Sentry Setup

Sentry is an error tracking and performance monitoring tool that helps you identify and fix issues in your application. Here's how to set it up for your project:

  1. Create a Sentry Account: If you don't already have one, sign up at sentry.io.

  2. Create a New Project: In the Sentry dashboard, create a new project for your SaaS application.

  3. Obtain Sentry Tokens:

    • SENTRY_AUTH_TOKEN: This is used for uploading source maps and other CI/CD tasks. You can create one in your Sentry account settings under "Auth Tokens".
    • NEXT_PUBLIC_SENTRY_DSN: This is your project's Data Source Name, which Sentry uses to identify which project an event should be associated with. You can find this in your project settings under "Client Keys (DSN)".
    • NEXT_PUBLIC_SENTRY_ORG: This is your Sentry organization name. You can find this in the URL of your Sentry project. For example, if your URL is https://your-organization.sentry.io/projects/your-project, then your Sentry organization name is your-organization.
    • NEXT_PUBLIC_SENTRY_PROJECT: This is your Sentry project name. You can find this in the URL of your Sentry project. For example, if your project URL is https://your-organization.sentry.io/projects/your-project, then your Sentry project name is your-project.
  4. Add Tokens to Environment Variables: Add these tokens to your apps/web/.env.local file:

    SENTRY_AUTH_TOKEN=your_auth_token_here
    NEXT_PUBLIC_SENTRY_DSN=your_dsn_here
    NEXT_PUBLIC_SENTRY_ORG=your_organization_name_here
    NEXT_PUBLIC_SENTRY_PROJECT=your_project_name_here
  5. Test the Integration: There is already an example client side error page in the app folder at sentry-example-page/page.tsx.

Remember to never commit your Sentry tokens to version control. Always use environment variables to store sensitive information.