Skip to content

notifications ​

DB inbox, channels with ACL, optional WS/mail

Cratesova-notifications 0.1.5
Plugin idnotifications
CategoryRealtime

Install ​

bash
cargo add sova --features notifications

Features ​

FeatureWhat you get
notificationsDB inbox + named channels / ACL.
notifications-authRole/permission audiences.
notifications-mailMail delivery channel.
notifications-templatesUnread helpers in templates.
notifications-wsPush notifications over WebSocket.

Overview ​

When: in-app notification inbox (DB) with channels / ACL; optional WS + mail.

Does:

  • Named channels + publish ACL
  • HTTP mount for inbox
  • Notify::to(user).channel(…).send(&req)
  • Optional realtime + mail features

Example ​

rust
app.install(Db::from_env().migrations::<NotificationsMigrator>());
app.install(Notifications::new().mount("/notifications"));
Notify::to(user_id).channel("orders").title("Shipped").send(&req).await?;

Quick start ​

DB inbox (+ optional WS / mail). Install Db first; install Ws before .ws_path(...):

rust
use sova::{Db, Notifications, NotificationsMigrator, Notify, Ws};

app.install(Db::from_env().migrations::<NotificationsMigrator>());
app.install(Ws::new());
app.install(
    Notifications::new()
        .channel(/* Channel::new("orders")… */)
        .mount("/notifications")
        .ws_path("/ws/notifications") // needs notifications-ws
        .guard(/* Fortify::guard() */),
);

// from a handler:
Notify::to(user_id)
    .channel("orders")
    .event("order.shipped")
    .title("Shipped")
    .send(&req)
    .await?;

Features: notifications-ws, notifications-mail, notifications-auth, notifications-templates.

Examples ​

db · ws · mail · auth