Skip to content

Using Spotlight with SvelteKit

This guide gets Spotlight up and running in SvelteKit with Sentry. You don’t strictly need Sentry for Spotlight to work but we highly recommend it.

1. Installation

Install Sentry

Follow the Sveltekit Getting Started guide to install and configure Sentry.

Install Spotlight

Install the Spotlight package:

Terminal window
npm add @spotlightjs/spotlight

2. Configuration

Initialize Spotlight after Sentry and start the Sidecar on the server. Just add a little code to your SvelteKit hooks files:

import * as Sentry from '@sentry/sveltekit';
import * as Spotlight from '@spotlightjs/spotlight';
dsn: '___DSN___',
tracesSampleRate: 1.0,
// ...your Sentry options
export const handleError = Sentry.handleErrorWithSentry();
if (import.meta.env.DEV) {
injectImmediately: true,

That’s it! Check out the Configuration to further customize Spotlight.