Installation
Install the browser SDK, add the Vite plugin, and create the client. The plugin instruments the app at build time.
- 1
Install the package
Add the browser SDK to your Vite app.
npm install @rasputin-ai/browser - 2
Add the Vite plugin
The plugin instruments the app and, after
vite build, uploads the debug data Rasputin needs to match errors to your source. It does not start the client. Pass the project API key only here, never in frontend code.How to set the release and API key at build timeimport { rasputin } from '@rasputin-ai/browser/vite'; import { defineConfig } from 'vite'; export default defineConfig({ plugins: [ rasputin({ release: process.env.RASPUTIN_RELEASE!, projectApiKey: process.env.RASPUTIN_PROJECT_API_KEY, }), ], }); - 3
Create your client
Call
RasputinInitfrom your client entry so the SDK is running before the rest of the app. Do not pass a project API key.import { RasputinInit } from '@rasputin-ai/browser'; export const rasputin = RasputinInit({ dsn: import.meta.env.VITE_RASPUTIN_DSN, environment: 'production', release: import.meta.env.VITE_RASPUTIN_RELEASE, }); - 4
That's it
The plugin instruments the build.
Configure buildsRasputinInitstarts reporting. Make sure every production build receives a git SHA and the project API key.
