Desktop notifications on Prompted — native Web Push, even when your browser is closed
## What it does
Prompted now sends **native OS desktop notifications** — the kind that slide in at the corner of your screen — when someone likes, comments, follows, reposts, or mentions you. They arrive even when Prompted **isn't the tab you're looking at**, and even when your **browser is fully closed**. Click one and it deep-links you straight to the post, stream, or notifications view it's about.
It's opt-in and per-device: you turn it on for the machines you want, and we never prompt you on load or notify you while you're actively on the page (the in-app toast already covers that).
## How to enable it
1. Open **Settings → 🔔 Desktop Notifications**
2. Flip the toggle **on**
3. Click **Allow** on your browser's permission prompt
That's it. If you ever blocked notifications by accident, the toggle tells you how to unblock them from the address-bar lock icon. Turning the toggle off unsubscribes that device cleanly.
## How it works under the hood
There are two cooperating layers, both reusing the realtime `notifications` infrastructure that already powers the in-app bell:
**1. Foreground notifications** — while a Prompted tab is open in the background, the existing realtime listener also fires a native `Notification`. No new infrastructure; it's the same hydrated notification row, rendered through a different API. Suppressed when the tab is focused so you never get double-notified.
**2. Web Push (closed-tab delivery)** — the real magic. A service worker (`/sw.js`) registers and subscribes the browser via the `PushManager` using our VAPID public key. The subscription (endpoint + encryption keys) is stored in a `web_push_subscriptions` table — the browser twin of the native `push_tokens` we use for the iOS/Android apps.
When a `notifications` row is inserted, a database webhook fans it out through the `send-push-notification` edge function. For web subscribers it:
- Signs a **VAPID ES256 JWT** (RFC 8292) so the push service trusts us
- **Encrypts the payload** with AES-128-GCM via ECDH + HKDF (RFC 8291 / RFC 8188)
- POSTs the encrypted body to each subscription's push endpoint (Mozilla, Google, Apple)
The push service then wakes the service worker — even with the browser closed — which draws the notification and handles the click-to-deep-link. Dead subscriptions (404/410) are auto-pruned.
## A fun gotcha
The VAPID **public key is pinned in the client bundle and must exactly match the private key** stored as an edge-function secret — they're a cryptographic pair. The private key is printed once at generation and never stored in the repo, so if you lose it you can't derive it from the public half: you regenerate the whole pair and update both sides. The edge function fails *soft* if the keys are wrong (returns 200, logs nothing user-visible), so the only true test is end-to-end: subscribe a browser, fire a notification, and watch for the OS popup. Ours popped. 🎉
Tech stack
- Claude Code
Links
Prompt steps
Step 1
we were working on a desktop notification system for prompted. there's a design document in docs if you can look at that, then look at whats done, it should all be done, we need 3 secret keys in supabase for it to work and I forgot them and what they should beStep 2
mouse has notifications on now, but it says only when tab is open? no way to do that even when firefox is closed? you could notify @mouse and see if I get a notification
10 likes · 5 comments · 13 views
Comments (4)
I love the upgrade. Can a place for forgot password be added? Also uhmmm profile information like the email that was used to create the account
yes! Let me cook something up!
Getting notifications even with the browser closed is a huge quality-of-life upgrade
The deep-linking feature is a nice touch for user experience.
Prompted keeps adding features that make it feel more like a native app.