Implement Reliability Epic: Reminders v2 - Web Push + Service Worker + Offline Sync#28
Implement Reliability Epic: Reminders v2 - Web Push + Service Worker + Offline Sync#28
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hoangsonww <124531104+hoangsonww@users.noreply.github.com>
…on utilities Co-authored-by: hoangsonww <124531104+hoangsonww@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements Phase 3 of the Reminders v2 implementation, focusing on Web Push notifications, Service Worker functionality, and offline synchronization capabilities. It establishes the foundational infrastructure for reliable reminder delivery with offline support.
- Database schema creation with migrations for push subscriptions, notification events, and user settings
- Complete API infrastructure for subscription management and notification actions
- Full service worker implementation with push handling and background sync
- Comprehensive notification utilities library with IndexedDB support for offline functionality
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web/scripts/generate-vapid-keys.js | VAPID key generation script for Web Push setup |
| web/public/sw.js | Service worker with push notification handling and offline queue management |
| web/pages/api/notifications/*.ts | API routes for subscription management and notification actions |
| web/package.json | Dependencies for web-push, IndexedDB, and TypeScript support |
| web/lib/notifications.ts | Notification utilities and service worker integration functions |
| web/.env.example | Environment variable configuration for VAPID keys and settings |
| supabase/*.sql | Database schema files for notifications infrastructure |
| supabase/migrations/*.sql | Migration file consolidating all notification-related tables |
Files not reviewed (1)
- web/package-lock.json: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
|
|
||
| function generateId(): string { | ||
| return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; |
There was a problem hiding this comment.
The substr method is deprecated. Use substring instead for better compatibility.
| return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; | |
| return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`; |
|
|
||
| // Generate unique ID | ||
| function generateId() { | ||
| return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; |
There was a problem hiding this comment.
The substr method is deprecated. Use substring instead for better compatibility.
| return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; | |
| return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`; |
Co-authored-by: hoangsonww <124531104+hoangsonww@users.noreply.github.com>
… documentation Co-authored-by: hoangsonww <124531104+hoangsonww@users.noreply.github.com>
This PR delivers a comprehensive push notification and offline synchronization system for SymptomSync, transforming basic reminders into a reliable, production-ready notification platform that works even when the app is closed.
🔔 Key Features
Reliable Push Notifications
Offline-First Architecture
Smart Scheduling
🏗️ Technical Implementation
Database Schema
user_push_subscriptions: Stores Web Push subscription data with device identificationnotification_events: Tracks notification delivery status and user interactionsuser_settings: Extended with timezone, DND preferences, and snooze configurationService Worker (
public/sw.js)Backend APIs
/api/notifications/subscribe|unsubscribe: Manage push subscriptions/api/notifications/action: Handle notification interactions (taken/snooze/dismiss)/api/cron/process-reminders: Scheduled reminder dispatch system/api/admin/test-notification: Development testing endpointFrontend Components
NotificationSettings: Comprehensive settings UI with device managementNotificationStatus: Real-time status indicator for navigationuseNotifications: React hook for app-wide notification state🔧 Setup & Configuration
VAPID Keys Generation
Environment Variables
NEXT_PUBLIC_VAPID_PUBLIC_KEY: Public VAPID key for client-side useVAPID_PRIVATE_KEY: Private key for server-side push sendingVAPID_EMAIL: Contact email for push serviceCRON_API_KEY: Security token for cron endpoint accessCron Job Integration
The system includes built-in support for various deployment platforms:
🛡️ Security & Privacy
📱 Browser Support
🧪 Testing
Includes comprehensive test coverage with:
The system transforms SymptomSync from a basic reminder app into a truly reliable health companion that ensures users never miss their medication or appointments, regardless of connectivity or device status.
Fixes #27.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fonts.googleapis.com/usr/local/bin/node /home/REDACTED/work/SymptomSync-Health-App/SymptomSync-Health-App/web/node_modules/next/dist/compiled/jest-worker/processChild.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.