This project demonstrates how to send Web Push Notifications using a Supabase Edge Function and @negrel/webpush.
Since popular web-push
libraries donβt work in Deno, this setup converts VAPID keys into JWK format and uses them inside a Supabase Edge Function.
- Supabase Edge Function with Deno runtime
- Push Notifications via @negrel/webpush
- VAPID key conversion utilities
- Handles multiple subscriptions stored in Supabase
- CORS enabled (ready for frontend clients)
- Supabase project
- Deno runtime (used by Supabase Edge Functions)
- A
subscriptions
table in Supabase
Generate VAPID keys here β https://vapidkeys.com/
Example output:
{
"subject": "mailto:test@gmail.com",
"publicKey": "BNWYBVKIbOTOvSZ-Sk5WYjAtEmPyhyq6axC4aMKg0IFHiPwWSrqDlx7j1sLnOkvdRmVGXiETpbePq_f2b6nDIDw",
"privateKey": "G3xcRcnvaJvOU6-p49nK0D4ZDCv5O1kD4WF2NGjeS_E"
}
Create a table in Supabase to store push subscriptions:
create table subscriptions (
id uuid primary key default gen_random_uuid(),
created_at timestamp with time zone default now(),
endpoint text not null,
keys jsonb not null
);
Example stored data:
{
"id": "4e4a4567-583b-4229-9c7c-32236d2259a5",
"created_at": "2025-08-18T07:03:38.709698+00",
"endpoint": "https://fcm.googleapis.com/fcm/send/cUrTRhWK4Io:APA91bHHV3ljE_0nIe6xi7eyuPitRdAqaLyUQr_ok0mzuJbE5eYLO2p8mt70MCwXuMOnazIsYdVOvZobnuNrhWf9uKhs-iiBSyywHgwwQ9M0xFKGuw2mlnpkx2FeJz5R-pr-aw9q5ith",
"keys": {
"auth": "IkRYX7oHtMTTC1bPyb0lBw==",
"p256dh": "BMVa1/ONWNvzwqczIVJz3q+bkT0yzIOLrgwZfzOd6B3nLi3FgqRSXdpe+kG2Ad4GoGy6MYx6z7H+gJbVB0PKEA8="
}
}
- Built with Supabase Edge Functions
- Push powered by @negrel/webpush
- VAPID keys generated via https://vapidkeys.com/
- Debugging + fixes assisted by Claude.ai π€