Push, In-App & Activity Feed

A comprehensive notification system covering in-app activity feeds, real-time push notifications, unread indicators, and notification preferences for all platform events across trainer and client roles.

Overview

Notifications keep users engaged and informed about platform activity relevant to them. The system covers seven distinct notification categories: new leads and connection requests, session reminders and schedule changes, client milestones and progress updates, direct messages and chat activity, new followers, comment replies and social interactions, and enrollment confirmations for marketplace purchases.

Notifications are delivered through two channels: an in-app activity feed accessible from the main navigation, and real-time push notifications for time-sensitive events. The activity feed displays a chronological list of events with icons, timestamps, and action links. Each notification has a read/unread state, and unread counts are displayed as badge indicators on the notification bell icon in the navigation header.

Different notification types are relevant to different roles. Trainers receive lead alerts with match percentages, client progress milestones, and enrollment notifications. Clients receive session reminders, program updates from their trainers, and social activity from followed trainers. Both roles receive message notifications and follower updates. Notification preferences allow users to control which events trigger push notifications versus appearing only in the activity feed.

Notification Types

Type Audience Trigger Priority Action
New Lead Trainer Client sends connection request High View lead → accept/pass
Session Reminder Both 24h and 1h before session High View/join session
Client Milestone Trainer Client completes goal/streak Medium View client profile
New Message Both Direct message received High Open conversation
New Follower Trainer Client follows trainer profile Low View follower profile
Comment Reply Both Someone replies to your comment Medium View post/comment
Enrollment Trainer Client purchases a program Medium View enrollment details

User Stories

All Users

As a user, I want to see an activity feed of platform events so that I stay informed about updates relevant to me.

As a user, I want to see unread notification counts in the nav bar so that I know when there is new activity to review.

As a user, I want to mark notifications as read individually or all at once so that I can manage my notification state.

As a user, I want to configure which events trigger push notifications so that I only receive alerts for things I care about.

Trainer

As a trainer, I want to receive instant alerts for new leads so that I can respond quickly and maximize conversions.

As a trainer, I want to be notified when a client hits a milestone so that I can celebrate their progress and keep them motivated.

Client

As a client, I want to receive session reminders so that I do not miss any scheduled training appointments.

As a client, I want to be notified when my trainer posts new content so that I can stay engaged with their tips and programs.

Data Model

Table Column Type Description
notifications id uuid Primary key
user_id uuid (FK) Recipient user
type enum lead | session | milestone | message | follower | comment | enrollment
title text Notification headline
body text Descriptive detail text
action_url text Deep link when notification is tapped
is_read boolean Whether the user has seen this notification
created_at timestamptz When the notification was generated
notification_preferences user_id uuid (FK) User whose preferences these are
type enum Notification type
push_enabled boolean Whether to send push for this type
email_enabled boolean Whether to send email for this type

Screens & Routes

/_authed/_onboarded/notifications (Planned) Full activity feed page with filters
Header Bell Icon (Planned) Notification dropdown in navigation header with unread badge
/_authed/_onboarded/settings Notification preferences section in account settings

Delivery Architecture

In-App Feed

Chronological list in the notification page and header dropdown. All notification types appear here. Supports read/unread state, mark all as read, and action deep links.

Real-Time Push

Supabase Realtime subscriptions for instant delivery. High-priority events (leads, messages, session reminders) trigger desktop/mobile push. Respects user preferences.

Email Digest (Future)

Daily or weekly email summary of unread notifications for users who have not visited the platform. Reduces notification fatigue while maintaining engagement.

Acceptance Criteria

  • Activity feed page displays a chronological list of notifications with icons and timestamps
  • Unread count badge appears on the notification bell icon in the navigation header
  • Clicking a notification navigates to the relevant page (lead, session, conversation, etc.)
  • Users can mark individual notifications or all notifications as read
  • Real-time updates via Supabase Realtime so new notifications appear without page refresh
  • Notification preferences in settings allow toggling push/email per notification type
  • Notifications are role-aware (trainers see lead/enrollment alerts; clients see session/content alerts)

API Surface

Server Functions (All Planned)

TODO getNotifications Paginated list with optional type filter
TODO getUnreadCount Count of unread notifications for badge
TODO markAsRead Mark single or all notifications as read
TODO updatePreferences Update push/email preferences per type
TODO createNotification Internal: triggered by DB functions/triggers

Current Status

Not Started

Notification Tables

Database schema for notifications and notification_preferences tables with RLS policies.

Not Started

Activity Feed UI

Notification page, header dropdown, unread badge, mark-as-read functionality.

Not Started

Real-Time Delivery

Supabase Realtime subscription for instant notification delivery without page refresh.

Not Started

Trigger Functions

Database triggers/functions that create notifications when platform events occur.

Not Started

Preferences UI

Settings section for users to control push/email notification preferences per type.

Not Started

Push Notifications

Browser push notification support via Service Worker and Push API integration.