Skip to content

notifications

DB inbox, channels with ACL, optional WS/mail · crate sova-notifications 0.1.0 · id notifications

bash
cargo add sova --features notifications,notifications-auth,notifications-mail,notifications-templates,notifications-ws
FeatureWhat you get
notificationsDB inbox + channels (sova-notifications).
notifications-authRole/permission audiences.
notifications-mailMail delivery channel.
notifications-templatesUnread helpers in templates.
notifications-wsPush notifications over WebSocket.

Database notifications with named channels, ACL, optional WS / mail.

rust
 app.install(
   Notifications::new()
     .channel(Channel::new("orders").publish("notifications.orders.publish"))
     .mount("/notifications")
     .guard(Fortify::guard())
 );
 Notify::to(user_id).channel("orders").event("order.shipped").title("Shipped").send(&req).await?;

Usage

DB inbox (+ optional WS/mail) on a full app — cabinet is the reference:

rust
let mut app = App::web()
    .site("App")
    .public_url("https://example.com")
    .into_app();

app.install(Db::from_env().migrations::<CabinetMigrator>());
app.install(Ws::new());
app.install(Notifications::new() /* feature flags: ws / mail / auth / templates */);

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