Majik Notification is a lightweight, framework-agnostic notification model designed for modern applications.
It works seamlessly across web apps, mobile apps, desktop apps, backend services, and edge environments.
Built as part of the Majikah ecosystem (and powering Majik Message), it provides a clean, JSON-safe way to create, manage, serialize, and react to notifications — without coupling your app to any UI framework or delivery mechanism.
- Majik Notification
- Cross-platform (Web, Mobile, Desktop, Backend, Edge)
- Framework-agnostic (React, Vue, Electron, Workers, etc.)
- JSON-safe serialization for APIs, databases, and queues
- Action-based events (trigger app logic without embedding functions)
- Extensible metadata for future-proofing
- Read / unread state handling
- Type-safe with full TypeScript support
- Auto-generated IDs (optional)
npm install @thezelijah/majik-notificationimport { MajikNotification } from "@thezelijah/majik-notification";const notification = new MajikNotification({
type: "message",
userID: "user_123",
message: "You received a new message",
});If no id is provided, one is auto-generated.
const notification = new MajikNotification({
type: "security",
userID: currentUser.id,
message: "New device signed in",
metadata: {
priority: "high",
user: {
id: "system",
name: "Majikah Security",
},
},
});Each notification always belongs to one user (userID).
metadata: {
priority: "normal",
user: {
id: "user_456",
name: "Zef",
photo: "https://thezelijah.world/avatar.png",
},
body: {
title: "New Message",
externalURL: "/messages/123",
},
references: ["message_123", "conversation_456"],
}
| Field | Purpose |
|---|---|
priority |
UI or delivery importance |
user |
Sender or related user info |
body |
UI display hints |
references |
IDs related to the event |
actions |
Triggerable actions |
* |
Any custom app-specific data |
Actions are data-only descriptors that map to runtime behavior.
metadata: {
actions: [
{
label: "Open Conversation",
action: "open-conversation",
url: "/messages/123"
}
]
}
⚠️ Actions are not functions. They are resolved at runtime via an action registry or handler system.
This keeps notifications:
- Serializable
- Secure
- Portable across environments
notification.markAsRead();notification.markAsUnread();if (notification.isRead()) {
// do something
}actions.forEach(action => {
console.log(action.label, action.action);
});
// or use getActions
myNotification.getActions()const json = notification.toJSON();This output is safe for:
- Databases
- APIs
- Realtime channels
- Message queues
{
"id": "notif_abc123",
"type": "message",
"userID": "user_123",
"message": "You received a new message",
"readAt": null,
"timestamp": "2026-01-25T12:34:56.000Z",
"metadata": {
"priority": "normal"
}
}
const notification = MajikNotification.fromJSON(json);Supports:
- Plain objects
- JSON strings
- Stored DB records
- API payloads
Invalid or malformed dates are safely handled.
- Store notifications as JSON
- Bind action handlers at app startu
- Use references for deep-linking
- Avoid embedding business logic in metadata
- Treat notifications as immutable events + mutable state
-
❌ Push notifications
-
❌ Email delivery
-
❌ UI rendering
-
❌ Action execution logic
This is intentional — Majik Notification is a core domain primitive, not a UI or transport layer.
- In-app notifications
- Messaging alerts
- Security warnings
- System updates
- Social interactions
- Billing events
- Desktop & Electron apps
- Edge & serverless environments
If you want to contribute or help extend support to more platforms, reach out via email. All contributions are welcome!
Apache-2.0 — free for personal and commercial use.
Made with 💙 by @thezelijah
- Developer: Josef Elijah Fabian
- GitHub: https://github.com/jedlsf
- Project Repository: https://github.com/jedlsf/majik-notification
- Business Email: business@thezelijah.world
- Official Website: https://www.thezelijah.world