Notifications
In-app notifications
git clone https://github.com/bijectionhq/notifications.git
cd notifications
git checkout 8eeeb547fe47cd8b2728b4cf2adda6e9cf005fdaBijection repository access is required. Request access.
Description
In-app notifications
Explore the package README for API concepts, configuration, and examples. Check the Bijection source for adaptation-specific setup.
Review the source and its dependencies before adopting this package. Source availability does not establish npm publication or runtime qualification.
Getting started
- Get the source at the revision above and read its package documentation.
- Check the required Bijection SDK version, dependencies, and external service credentials.
- Follow the package setup instructions and the guide to using components.
- Exercise the component in your deployment according to your project’s verification rules.
Open source
Maintained source: bijectionhq/notifications. Based on ben-katz/convex-notification. License: Apache-2.0. Consult the repository for license terms, notices, and contributor attribution.
From the upstream publisher
A Convex component for typed, scalable in-app notifications.
Explore the demo ↗Upstream overview
From the upstream package documentation.
A fully-configurable Convex component that provides a typed notification system for in-app messaging. It handles the storage, querying, and delivery of notifications within your Convex application.
Use cases
From the upstream package documentation.
How it works
From the upstream package documentation.
Add the component to your app:
// convex/convex.config.ts
import { defineApp } from "convex/server";
import notification from "convex-notification/convex.config.js";
const app = defineApp();
app.use(notification);
export default app;
Register the notification payloads your app supports:
// convex/notifications/client.ts
import { v } from "convex/values";
import { components } from "../_generated/api";
import { defineNotifications } from "convex-notification";
export const notifications = defineNotifications(components.notification, {
defaultListLimit: 50, // Used when querying without pagination.
batchChunkSize: 100, // Page size when querying with pagination.
kinds: {
// These can be configured to your needs
team_invite: v.object({
title: v.string(),
body: v.optional(v.string()),
href: v.string(),
inviteId: v.string(),
}),
admin_broadcast: v.object({
title: v.string(),
body: v.optional(v.string()),
href: v.optional(v.string()),
}),
},
});
Expose App-Facing Functions with your own auth resolution:
// convex/notifications/api.ts
import { makeNotificationAPI } from "convex-notification/server";
import { getCurrentUserOrThrow } from "../auth";
import { notifications } from "./client";
export const userNotifications = makeNotificationAPI(notifications, {
resolveTargetId: async (ctx) => {
const user = await getCurrentUserOrThrow(ctx);
return user._id;
},
});
Export the generated Convex functions:
// convex/notifications.ts
import { userNotifications } from "./notifications/api";
export const {
list,
listPage,
counts,
unseenCount,
markSeen,
markAllSeen,
dismiss,
dismissAll,
} = userNotifications;
Create notifications from the backend:
await notifications.create(ctx, {
targetId: userId,
kind: "team_invite",
data: {
title: "You were invited to a team",
body: "Open the invite to accept it.",
href: "/invite/abc123",
inviteId: "abc123",
},
source: { type: "invite", id: "abc123" },
dedupeKey: "invite:abc123",
});
The data object is type-checked from your registered kind configuration.
Upstream package FAQ
How does convex-notification prevent duplicate notifications?
Convex-notification supports idempotent creates using dedupeKey parameters. When creating notifications with the same dedupeKey, only one notification is stored, preventing duplicates during retries or bulk operations.
Can I send email or push notifications with this component?
Convex-notification does not send emails or push notifications directly. Instead, use lifecycle hooks like onNotificationCreated to connect notification creation to external email services or push notification systems.
How are notification counts calculated without table scans?
The convex-notification component maintains counts in a separate targetStats table that updates when notifications are created, marked seen, or dismissed. This provides O(1) badge counts without scanning the entire notification table.
What is the difference between notification kinds and target types?
Notification kinds define the payload structure for different notification types (like team_invite or admin_broadcast). Target types determine who receives notifications (users, teams, projects) and are handled by creating separate API wrappers with different authorization logic.
How does bulk notification processing work?
Convex-notification uses a Workpool child component for bulk notification delivery. Call enqueueBatch to queue notifications for multiple targets, and the system processes them in the background with configurable batch chunk sizes.
Use with agents and CLI
Give your coding agent the component’s source identity and setup guidance.
Help me integrate Notifications with Bijection.
Read: https://bijection.com/components/notifications/SKILL.md
Check SDK compatibility and dependency availability.
Follow this project's execution and verification rules.Upstream README.md
View repository ↗Documentation from ben-katz/convex-notification at its recorded upstream revision. APIs and setup may differ in the Bijection adaptation.
Loading package documentation…