Direct Push

Send push notifications from Convex directly to APNs, FCM HTTP v1, and Web Push with a built-in device registry, durable delivery queue, and no relay service.

Installation

npm install @vllnt/convex-push

About Direct Push

Send push notifications straight from your Convex backend to Apple (APNs), Google (FCM HTTP v1) and browsers (Web Push), with no relay service in the path. @vllnt/convex-push signs and sends every request itself.

Use cases
- Mobile apps: notify iOS and Android devices from a mutation or scheduled function.
- Web apps: deliver Web Push to subscribed browsers.
- Agents and workflows: notify a person when a long-running task needs them.
- Multi-provider fan-out: one send reaches every registered device of a subject.

How it works
Mount the component and create a Push client. The device registry is deduplicated per address, with token rotation and subject moves. Sends go through a durable queue with one delivery per device and one workpool per provider, so a slow provider cannot starve the others. Retries use exponential backoff and honour Retry-After and message expiry. Dead devices are cleaned up automatically, with a safety pause when an app's APNs topic or environment is misconfigured. Provider tokens are cached and encrypted. Custom providers and delivery hooks work without forking. Message content is scrubbed at rest once delivered, and sends are idempotent with per-message status.

Integration
Your backend decides who may register devices and who gets notified; the component stores devices and delivers. Install with npm install convex @vllnt/convex-push@canary (requires convex 1.47+). Version-matched docs and llms.txt ship in the npm package for coding agents. Status: 0.1.0 canary; delivery to real devices has not been verified yet.

Links: [GitHub](https://github.com/vllnt/convex-push), [npm](https://www.npmjs.com/package/@vllnt/convex-push), [docs](https://oss.vllnt.com/packages/convex-push). Related components: [@vllnt/convex-notifications](https://github.com/vllnt/convex-notifications) and [@vllnt/convex-email](https://github.com/vllnt/convex-email).

Maintained by [bntvllnt](https://bntvllnt.com) at [VLLNT](https://vllnt.com). Find the author on [GitHub](https://github.com/bntvllnt) and [X](https://x.com/bntvllnt).

Benefits

Use cases

how to send push notifications from Convex backend to iOS and Android

@vllnt/convex-push lets you call push.send(ctx, { to: { subjectRef }, title, body }) from any Convex mutation or scheduled function to reach all registered devices for a user. The component handles APNs and FCM HTTP v1 directly using your own Apple key and Firebase service account, with no Expo push relay involved. Devices are registered via push.register() and deduplicated per address automatically.

push notifications with retry logic and delivery tracking in Convex

@vllnt/convex-push queues each send through a durable internal queue with exponential backoff retries, up to a configurable maxAttempts (default 5, max 20). It respects Retry-After headers and message TTL, and you can call push.status(ctx, messageId) to inspect per-device delivery state including error codes on failed deliveries. Message content is scrubbed at rest once delivered.

how to notify users when a Convex AI agent or workflow finishes

@vllnt/convex-push is designed for agentic workflows where a backend task needs to notify a person on completion. Call push.send() from an internalMutation at the end of a scheduled function or workflow step, targeting the user by subjectRef. All registered devices for that subject receive the notification in a single fan-out send.

web push notifications from Convex with VAPID keys

@vllnt/convex-push supports Web Push using VAPID keys alongside APNs and FCM in the same component. Register browser subscriptions with platform set to webpush, then use push.send() to reach subscribed browsers. The component signs and sends Web Push requests itself without delegating to an external service.

Frequently asked questions

Does @vllnt/convex-push use Expo's push service or send directly to APNs and FCM?

@vllnt/convex-push sends directly to APNs, FCM HTTP v1, and Web Push using your own Apple key, Firebase service account, or VAPID keys. It does not route through Expo's push relay. If you want Expo to manage your Apple and Google credentials, the README recommends @convex-dev/expo-push-notifications instead.

How does @vllnt/convex-push handle failed deliveries and dead devices?

@vllnt/convex-push retries failed deliveries with exponential backoff, honoring Retry-After headers and per-message TTL (default 86400 seconds, max 28 days). Dead devices are cleaned up automatically, with a safety pause when an APNs topic or environment is misconfigured. You can inspect delivery error codes via push.status() and the DELIVERY_ERROR_CODES export.

Can I send push notifications to multiple devices for the same user in one call?

@vllnt/convex-push performs multi-device fan-out automatically. When you call push.send(ctx, { to: { subjectRef }, ... }), the component delivers to every active registered device associated with that subject. Devices are deduplicated per address at registration time, and each delivery is tracked independently with its own status.

What version of Convex does @vllnt/convex-push require?

@vllnt/convex-push requires convex 1.47 or later. Install it with npm install convex @vllnt/convex-push@canary. The canary tag is used until the 0.1.0 stable release. The component ships llms.txt, API.md, and TypeScript source inside the npm package for use by coding agents.

Can I add a custom push provider or hook into delivery events with @vllnt/convex-push?

@vllnt/convex-push supports custom providers via a host action that conforms to the CustomSender type, and delivery hooks via a host mutation conforming to DeliveryHook. Both are configured through PushOptions when constructing the Push class, and neither requires forking the component. The same durable queue and retry logic applies to custom providers.

Links

Components

Open-source building blocks for your Convex app

Browse components in this category.

Loading components