Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
@carbon/notifications
Notification event taxonomy — enums and topic mapping shared across app routes, jobs, and Inngest functions.
Always
- Import
NotificationEventfrom@carbon/notifications— this is the single source of truth for event types - Map new events to a
NotificationTopicingetNotificationTopic()— every event must belong to exactly one topic - Remember topic strings are persisted —
NotificationTopicvalues are stored in thenotification.topicDB column; renaming is a migration - Dispatch via
trigger("notify", payload)from@carbon/lib— thecarbon/notifyInngest function handles fan-out (inApp / email / Slack; browser push mirrors inApp)
Ask First
- Renaming any
NotificationTopicenum value (requires a DB migration) - Adding a new
NotificationDestinationbeyond inApp/email/Slack
Never
- Put fan-out logic in this package — it's enum-only; fan-out lives in
packages/jobs - Send notifications directly — always go through the
trigger("notify", ...)pathway
Validation Commands
pnpm --filter @carbon/notifications typecheck # tsc --noEmit
Key Patterns
- Enums + pure mapping helpers, no I/O —
NotificationEvent,NotificationTopic,NotificationDestination;getNotificationTopic, email heading/CTA helpers, andUSER_FACING_NOTIFICATION_TOPICS(display order for the account notification-settings page — when adding aNotificationTopic, add it here too or it won't appear on that page), plusgetNotificationTopicChannels(which switches a topic's row offers) andisNotificationTopicEnabledByDefault(what no preference row means —falseonly for the opt-in, email-onlyChangelognewsletter),getNotificationTopicScope(accountonly forChangelog: one setting across all the user's companies) andnotificationPreferenceCompanyId(thecompanyIda topic'snotificationPreferencerow is stored under —nullfor an account topic — used by every reader and writer:users.service.tsand thenotifyfan-out). Both take aNotificationTopic; narrow a storedtopic(a TEXT column) withisNotificationTopicfirst. Making a topic account-level is one arm ingetNotificationTopicScopeplus a data migration that folds its per-company rows into one NULL row per user (copy the backfill in20261019124417_account-notification-preferences.sql); no schema, RLS or reader change. The changelog dispatcher is the one reader that names its topic - Body rendering lives here, all three renditions together —
renderInlineLinks(the strict[label](https://origin/…)matcher; a security boundary, since a workflow's message body is customer-authored) plusrenderSlackMrkdwn/escapeSlackTextfor the Slack rendition. The in-app topbar andNotificationEmail.tsxconsume the segments directly. A fourth channel adds its rendition beside these, not in the fan-out job NotificationEvent.Workflowis the payload-text kind — every other event's content is read from its source document; this one carriestitle/bodyon thecarbon/notifypayload and reads nothing. Raised by the workflows notify action (packages/jobs/src/workflows/actions/notify.ts), topicGeneral- inApp is always included — regardless of caller-specified destinations
- Browser push mirrors inApp — it is neither a
NotificationDestinationnor aNotificationPreferenceChannel:notifypushes every notification to every recipient's enabled browsers, with no per-topic switch - Single export:
@carbon/notificationsbarrel fromsrc/index.ts
Cross-References
packages/lib/src/events.ts— typedEvents["carbon/notify"]payloadpackages/lib/src/trigger.ts—trigger("notify", ...)dispatch helperpackages/jobs/— Inngestnotifyfunction (fan-out implementation)