Notifications System
The Kenya Estates platform features a comprehensive notifications system to keep users informed about important events, messages, and updates related to their activities and interests.
1. Purpose of Notifications
Notifications serve several key purposes:
- Timely Updates: Inform users about new messages, inquiry responses, property status changes, or new listings matching their saved searches.
- Engagement: Encourage users to return to the platform by alerting them to relevant activities.
- Information Dissemination: Provide updates on platform news, new features, or important announcements.
2. Types of Notifications
The platform may generate various types of notifications, including:
- New Message Alerts: When a user receives a new direct message. (See
app/actions/message-actions.ts
). - Inquiry Updates: Notifications about responses to property inquiries or status changes. (See
app/actions/inquiry-actions.ts
). - Property Alerts: For users who have saved searches, notifications about new properties matching their criteria.
- Favorite Property Updates: Alerts if a favorited property has a status change (e.g., price drop, sold).
- Admin/System Announcements: Important updates from platform administrators.
- Content Notifications: Optional notifications for new blog articles or market insights, based on user preferences. (See
supabase/migrations/20250512093900_add_content_notifications_preference_to_users.sql
).
3. Notification Delivery
Notifications are typically delivered through:
- In-App Notifications: Displayed within the platform, often via a notification icon and dropdown menu. (See
components/notifications/notification-icon.tsx
,components/notifications/notification-dropdown.tsx
,components/notifications/notification-item.tsx
). - Email Notifications: Sent to the user's registered email address for critical alerts or if the user is offline. (See
lib/email.ts
).
4. User Interface for Notifications
- Notification Icon: Usually located in the navigation bar, displaying a badge with the count of unread notifications. (
components/notifications/notification-icon.tsx
). - Notification Dropdown/Panel: Clicking the icon reveals a list of recent notifications. Each item typically shows a brief summary and a link to the relevant content. (
components/notifications/notification-dropdown.tsx
,components/notifications/notification-item.tsx
). - Dedicated Notifications Page: A full page listing all notifications, often with filtering and management options. (
app/dashboard/notifications/page.tsx
).
5. Managing Notifications
- Mark as Read/Unread: Users can mark individual or all notifications as read.
- Deleting Notifications: Option to remove notifications from their list.
- Notification Preferences: Users can customize which types of notifications they wish to receive. This is often managed in the user profile settings. (Related to
app/actions/profile-actions.ts
and theusers
table preference columns).
6. Technical Implementation
- Database Schema: A dedicated
notifications
table stores notification data, including recipient, type, content, read status, and timestamps. (Seesupabase/migrations/20250512080700_create_notifications_table.sql
). - Notification Generation: Server actions (e.g.,
app/actions/notification-actions.ts
) are responsible for creating notifications when specific events occur (e.g., new message, new inquiry response). - Real-time Updates (Optional): For instant delivery of in-app notifications, technologies like WebSockets or Supabase Realtime can be used.
- Fetching Notifications: Client components fetch notifications for the logged-in user to display in the UI.
- Background Jobs (for Email): Email notifications might be queued and sent via background jobs or serverless functions to avoid delaying user requests.
An effective notification system enhances user experience by providing relevant and timely information, keeping users connected and engaged with the platform.