Contextual feedback collection and AI-assisted resolution for SvelteKit applications.
Svelte Beacon captures user feedback in context — screenshots, element selectors, browser metadata — and provides a dashboard for managing tasks and an AI agent for executing them. It integrates into any SvelteKit app with two lines of code.
/__beacon/ with filters, bulk actions, and activity logsnpm install svelte-beacon
npx beacon init
The init command creates a .beacon/ directory for the local database and adds it to .gitignore.
In src/hooks.server.ts:
import { beacon } from 'svelte-beacon/server';
import { sequence } from '@sveltejs/kit/hooks';
import { dev } from '$app/environment';
export const handle = sequence(
beacon({
enabled: true,
mode: dev ? 'development' : 'deployed',
}),
// ...your other hooks
);
In src/routes/+layout.svelte:
<script>
import { Beacon } from 'svelte-beacon';
let { children } = $props();
</script>
{@render children()}
<Beacon />
That's it. Visit your app and click the feedback button in the bottom-right corner. Access the dashboard at /__beacon/.
The beacon() function accepts a BeaconOptions object:
beacon({
enabled: true,
mode: 'development',
database: 'file:.beacon/beacon.db',
databaseAuthToken: undefined,
adminEmails: ['[email protected]'],
widget: {
screenshot: true,
elementSelector: true,
aiAssist: true,
requireEmail: false,
position: 'bottom-right',
},
ai: {
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
maxDurationMinutes: 30,
requireTestsForBugs: true,
createPR: false,
},
})
| Option | development |
deployed |
|---|---|---|
| Auth required | No | Yes |
| Screenshot capture | Yes | No |
| Element selector | Yes | Yes |
| AI assist | Yes (if API key) | No |
| Email required | No | No |
Access the dashboard at /__beacon/ in your running app. It provides:
In deployed mode, the dashboard requires authentication via magic link email sent to addresses in the adminEmails list.
# Initialize Beacon in your project
npx beacon init
# Remove Beacon from your project
npx beacon teardown
# Pull tasks from a remote Beacon instance
npx beacon pull --remote https://example.com --token <bearer-token>
When an anthropicApiKey is configured, the widget offers AI-assisted description improvement. The AI analyzes the feedback context (type, priority, page URL, selected element) and suggests a more detailed description.
When the Claude Code CLI is installed, the dashboard can start an AI agent to work on tasks. The agent:
| Variable | Purpose |
|---|---|
ANTHROPIC_API_KEY |
Enables AI widget assist (Layer 1) and agent (Layer 2) |
BEACON_DATABASE |
Override database URL (default: file:.beacon/beacon.db) |
BEACON_AUTH_TOKEN |
Database auth token for Turso connections |
npx beacon teardown
This removes the .beacon/ directory and its .gitignore entry. Then remove the beacon() call from your hook and the <Beacon /> component from your layout.