Features
PreviousNext

Monitoring

Tools to monitor your application, to track errors and events.

In this page, we will see how to setup monitoring in your application.

We are using Sentry as monitoring provider.

Installation

Project Setup

Make sure that the @kit/monitoring package is installed.

pnpm add '@kit/monitoring@workspace:*'

Paste the following code in your instrumentation.ts file of your application.

instrumentation.ts
import { MonitoringProvider } from '@kit/monitoring';
 
export const register = MonitoringProvider.register;
export const onRequestError = MonitoringProvider.captureRequestError;
 

The next step is to set the sentry environment variables.

Sentry Setup

Here is where you will find the sentry environment variables.

Environment VariableDescription
SENTRY_ORGThe organization slug.
Go to Sentry > Settings > Organization.
You can also find it in the url subdomain.
SENTRY_PROJECTThe project name.
Present in the url after /projects/
NEXT_PUBLIC_SENTRY_DSNThe Sentry DSN.
Go to the project settings page. Then click on Client Keys (DSN).
SENTRY_AUTH_TOKENThe Sentry auth token.
Go to Sentry > Sentry > Organization Tokens
Then create and copy a token for your project.

Environment variables

# ============================================
# 📈 MONITORING & ERROR TRACKING
# ============================================
 
SENTRY_ORG="your-sentry-org"
SENTRY_PROJECT="your-sentry-project"
NEXT_PUBLIC_SENTRY_DSN='https://xxxxxxxxxxx@xxxxx.ingest.de.sentry.io/xxxxxxxx'
SENTRY_AUTH_TOKEN="your-sentry-auth-token"

How is this guide?

Last updated on 10/17/2025