Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 625 Bytes

File metadata and controls

40 lines (26 loc) · 625 Bytes

Web-push Svelte-kit Sample

  1. Set your VAPID in .env (use my .env.exampl)
bun install
bunx web-push generate-vapid-keys
# then it will give you keys
  1. Create and Migrate DB
bun run db:create
bun run db:migrate
  1. Run dev server
bun run dev --open
  1. Clicks subscribe Button (src/+page.svelte)

  1. Subscribe alarm (src/api/subscribe/+server.ts)

  1. Visit /web-push endpoint. it will send you a alarm (src/web-push/+server.ts)

Tech stack

  • Sveltekit for frontend and backend
  • web-push for push notification
  • drizzle for Orm (to save Subscription in DB)
  • sqlite