bugsnap

guide ยท react & vite

Free bug report widget for React & Vite (18 KB, MIT)

Paste BugSnap's single <script> tag into index.html before </body>. Unlike npm modal libraries that leave screenshots and the backend to you, BugSnap is 18 KB (about 8 KB gzipped), masks sensitive inputs, and is $0 free forever.

1. add it to index.html (recommended for Vite + React)

In any Vite, Create React App or React SPA project, open index.html and add the deferred script tag right before </body>:

<script
  src="https://getbugsnap.pages.dev/widget.js"
  data-project-key="YOUR_PROJECT_KEY"
  data-trigger="on-error"
  defer
></script>

To keep the key per environment, use Vite's HTML env replacement: put VITE_BUGSNAP_KEY in .env and write data-project-key="%VITE_BUGSNAP_KEY%" in index.html.

2. invisible on-error mode or a floating button

  • data-trigger="on-error" (recommended): nothing renders until a visitor hits an uncaught error, failed API call, broken image, UI freeze or dead click.
  • data-trigger="floating": shows a small bug button in the corner. Add data-position="bottom-left" or data-accent="#175846" to match your app.

3. why BugSnap instead of a DIY React modal package

  • No upload backend to maintain: reports land in your BugSnap inbox, GitHub Issues, Slack, Discord or a webhook.
  • No monthly-active-user paywall: the free hosted tier covers 5 projects and 100 reports a month, and MIT self-hosting is unlimited.
  • Built-in masking: passwords, emails, card fields and Stripe and PayPal iframes are masked before capture, and visitors choose Cropped, Full or No screenshot before sending.
  • AI-ready Markdown: copy any report into Cursor, Claude Code or Codex, or try the format with the free bug report to AI prompt generator.

Want the details? Read how BugSnap masks cards, passwords and tokens before a screenshot exists, and how to turn live bug reports into prompts for AI coding agents.

frequently asked questions

Does BugSnap work with React 18, React 19 and React Router?

Yes. It runs outside the React tree and renders its own UI inside a Shadow DOM, so route changes and React versions do not affect it.

Can I use this in a Vue + Vite app too?

Yes. The same script tag in Vite's index.html works the same way in Vue, Svelte and Solid apps.

Is BugSnap open source?

Yes. BugSnap is MIT licensed on GitHub at github.com/karancdev/bugsnap and has zero runtime dependencies.

add bugsnap in one line.

$0 free forever and MIT open source. Hidden until a real bug, privacy masking always on.

<script src="https://getbugsnap.pages.dev/widget.js" data-project-key="YOUR_PROJECT_KEY" data-trigger="on-error" defer></script>