Skip to content

Add browser push notification backend#589

Open
momocentral wants to merge 1 commit into
mainfrom
browser-push-notifications
Open

Add browser push notification backend#589
momocentral wants to merge 1 commit into
mainfrom
browser-push-notifications

Conversation

@momocentral
Copy link
Copy Markdown
Collaborator

Summary

Adds backend support for browser push notifications.

Implemented:

  • Push subscription API endpoints:
    • fetch VAPID public key
    • register/update browser subscription
    • list current user's subscriptions
    • delete subscription
  • PushSubscription model, schemas, CRUD, and Alembic migration
  • Web Push delivery service using pywebpush
  • Alert detection hook to send browser notifications when an alert is created
  • VAPID-related settings in .env.example
  • Endpoint tests for subscription registration, fetch, delete, and public key behavior

Required deployment steps

After merging:

  1. Install updated dependencies.
  2. Run Alembic migrations.
  3. Configure:
    • VAPID_PUBLIC_KEY
    • VAPID_PRIVATE_KEY
    • VAPID_SUBJECT
    • PLATFORM_URL
    • optional PUSH_NOTIFICATIONS_TTL_SECONDS

Verification

I verified locally that:

  • the API container starts healthy
  • Alembic reaches the new migration head
  • the push_subscriptions table exists
  • pywebpush imports successfully
  • the push notification client is enabled when VAPID settings are present

@momocentral momocentral force-pushed the browser-push-notifications branch 2 times, most recently from e7dc57b to c2b22bd Compare May 11, 2026 18:39
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 95.36424% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.22%. Comparing base (74395ab) to head (14625fe).

Files with missing lines Patch % Lines
src/app/api/api_v1/endpoints/detections.py 57.14% 3 Missing ⚠️
src/app/crud/crud_push_subscription.py 78.57% 3 Missing ⚠️
src/app/api/api_v1/endpoints/push_subscriptions.py 96.87% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #589      +/-   ##
==========================================
+ Coverage   89.92%   90.22%   +0.30%     
==========================================
  Files          55       59       +4     
  Lines        2451     2598     +147     
==========================================
+ Hits         2204     2344     +140     
- Misses        247      254       +7     
Flag Coverage Δ
backend 90.21% <95.36%> (+0.31%) ⬆️
client 90.40% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@momocentral momocentral force-pushed the browser-push-notifications branch 4 times, most recently from 8371f86 to d4c144d Compare May 11, 2026 19:20
@momocentral momocentral force-pushed the browser-push-notifications branch from d4c144d to 14625fe Compare May 11, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants