Feature: first-class notifications module (in-app + email + optional push)

Aperta
#17 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
15/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
go, react
Ambito
api, backend, frontend

Direzione di ricerca

The first read is the existing Mailer, Asynq queue, Cache, Pulse metrics, Grit UI registry and generated React Query patterns. The proposal puts the module in internal/notify with models.Notification, notify.Send, notify.Scheduler, notify.Rule and notify.Channel; API endpoints and the useNotifications()/bell component define the surface. Done means the acceptance criteria: default models, send API with pluggable channels, hook, bell badge, and an example cron reminder. Because it is design-heavy, confirm scope with maintainers first.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

Hand-rolled this in a Grit project and it felt like a universal pattern that belongs in the framework. Nearly every SaaS / admin app needs: in-app notification inbox (unread counter, bell icon, mark all read); email fan-out for the same event; idempotent scheduled reminders.

Grit ships the ingredients (Mailer, Asynq, Cache) but nothing that ties them together.

Proposal

Add internal/notify as a first-class battery:

notify.Send(ctx, notify.Event{
    Type: "invoice.sent",
    RecipientUserID: user.ID,
    RecipientEmail:  tenant.Email,
    Title:   "Invoice INV-202604-0042 issued",
    Message: "Amount due: UGX 1,200,000.",
    Link:    "/invoices/abc",
    Channels: notify.ChannelInApp | notify.ChannelEmail,
})
Built-in components
  • models.Notification (user-scoped, unread/read, link)
  • notify.Scheduler for delayed / recurring notifications (reminder use case)
  • notify.Rule — hook points for "when X transitions to Y, send notification Z"
  • notify.Channel interface — InApp, Email, Push, Slack — pluggable
  • Admin dashboard (Grit UI) listing recent events, delivery status, retry failed
Endpoints scaffold
  • GET /api/notifications?status=unread
  • PUT /api/notifications/:id/read
  • PUT /api/notifications/read-all
  • WebSocket/SSE endpoint for real-time push to the admin UI
Leverages existing batteries
  • Mail: existing Mailer for email channel
  • Jobs: Asynq-queued deliveries with retries
  • Cron: scheduled reminders pipeline
  • Pulse: delivery metrics

Why this is worth doing

In my rental-manager project, the reminders system (rent due 7/0/+3 days, lease renewal 30/15/0 days, dispatch worker) ended up as ~400 lines of thoughtful code that every Grit app will rewrite. Owning this in the framework means one canonical Notification schema + a proven idempotent pattern (offset_days + entity_id dedup) + a reusable NotificationBell component.

Acceptance criteria

  • Notification + Reminder models registered by default
  • notify.Send(ctx, Event) API + pluggable channels
  • React Query useNotifications() hook in generated frontend
  • Bell component in Grit UI registry with unread badge
  • Example cron-driven reminder (subscription expiring in 7 days)

Happy to port the sweep + dispatch logic from my app as a starting PR.

Lingua principale
Go
Stelle
152
Fork
20
Merge medio
1g 49m
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MUKE-coder/grit

Tutte le issue di MUKE-coder/grit

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.