@fernando.mema/sv-sentry
v0.1.1
Published
<a id="readme-top"></a>
Maintainers
Readme
View Sentry Docs · Report Bug · Request Feature
About
This addon sets up Sentry in your SvelteKit project with:
- Browser-side error tracking
- Server-side error tracking
- Session replay support
- Source map upload configuration
- Vite plugin integration
Installation
npx sv add @fernandomema/sv-sentryOptions
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| browser | boolean | true | Enable Sentry for browser (client-side) |
| server | boolean | true | Enable Sentry for server (server-side) |
| replays | boolean | false | Enable Session Replays (browser only) |
What It Does
Files Created
| File | Purpose |
|------|---------|
| src/lib/sentry.client.ts | Browser-side Sentry initialization |
| src/lib/sentry.server.ts | Server-side Sentry initialization |
| sentry.client.config.ts | Client config (if server enabled) |
| sentry.server.config.ts | Server config (if server enabled) |
Files Modified
| File | Changes |
|------|---------|
| .env | Adds PUBLIC_SENTRY_DSN, SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT |
| .env.example | Adds environment variable templates |
| src/hooks.server.ts | Adds Sentry server handle |
| src/hooks.client.ts | Adds client-side Sentry import |
| vite.config.ts | Adds Sentry Vite plugin (if server enabled) |
| package.json | Adds sentry:sourcemaps script |
Environment Variables
| Variable | Description |
|----------|-------------|
| PUBLIC_SENTRY_DSN | Sentry DSN for client-side error tracking |
| SENTRY_AUTH_TOKEN | Sentry auth token for source maps upload |
| SENTRY_ORG | Sentry organization slug |
| SENTRY_PROJECT | Sentry project slug |
Next Steps
After installation:
- Set
PUBLIC_SENTRY_DSNin.env - Set
SENTRY_AUTH_TOKEN,SENTRY_ORG, andSENTRY_PROJECTin.env - Run
npm run sentry:sourcemapsto upload source maps after building - If Session Replays enabled, check Sentry dashboard for recordings
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE.txt for more information.
Contact
Fernando - @fernandomema
Project Link: https://github.com/fernandomema/sv-addons
Acknowledgments
- Sentry - Error tracking platform
- Svelte CLI - Official Svelte tooling
- Best README Template - README template
