Simple Vite + Vue web push demo with a Vercel serverless API.
- Install deps
npm install
- Generate VAPID keys
npx web-push generate-vapid-keys
- Create
.envfrom.env.exampleand paste the keys. - Run dev server
npm run dev
Set the same env vars in your Vercel project:
VITE_VAPID_PUBLIC_KEYVAPID_PUBLIC_KEYVAPID_PRIVATE_KEYVAPID_SUBJECT
Deploy, then open the site and click Subscribe and Send Test Push.