Skip to content

HLVM04/IDAEventNotifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

IDA Event Notifier (Bun + PWA Push)

This project now includes a Bun backend that polls IDA events and sends Web Push notifications to installed PWAs.

That means notifications can be delivered while the app is not open, including on iOS (when installed to Home Screen and push permission is granted).

Architecture

  • Frontend PWA:
    • Installable app shell + service worker
    • Subscribes to push and registers subscription with backend
    • Supports city-based notification filter (for example Odense)
    • Shows latest events snapshot from backend
  • Bun backend:
    • Polls IDA API on a schedule
    • Stores seen event IDs, push subscriptions, and subscriber preferences in SQLite
    • Sends push messages to subscribers when new meetup IDs appear
    • Sends deep links to IDA event pages using meetupNumber

Requirements

  • Bun 1.0+
  • HTTPS in production (required for Web Push on mobile/iOS)
  • iOS 16.4+ for Home Screen Web Push support

Setup

  1. Install dependencies:
bun install
  1. Generate VAPID keys:
bun run vapid:generate
  1. Create .env from .env.example and fill in values:
  • IDA_API_USERNAME
  • IDA_API_PASSWORD_B64 (base64-encoded IDA password)
  • IDA_AUTH_URL if the auth endpoint changes
  • VAPID_PUBLIC_KEY
  • VAPID_PRIVATE_KEY
  • VAPID_SUBJECT
  • CORS_ALLOW_ORIGIN if frontend is hosted on a different origin than backend

To produce IDA_API_PASSWORD_B64 locally:

printf %s 'your-password-here' | base64

Run

bun run dev

Open:

  • http://localhost:3000

Docker Compose deployment

  1. Ensure .env exists and contains valid values for:
  • IDA_API_USERNAME
  • IDA_API_PASSWORD_B64
  • VAPID_PUBLIC_KEY
  • VAPID_PRIVATE_KEY
  • VAPID_SUBJECT
  1. Build and start:
docker compose up -d --build
  1. Check status and logs:
docker compose ps
docker compose logs -f ida-event-notifier
  1. Stop:
docker compose down

Data is persisted in the named volume notifier-data.

Update on server

git pull
docker compose up -d --build

iOS closed-app notifications

  1. Serve the app over HTTPS on a real domain (not plain HTTP).
  2. Open the site in Safari on iPhone.
  3. Add to Home Screen.
  4. Launch the installed app and tap Enable Background Push.
  5. Allow notifications when prompted.

The app now shows explicit subscription diagnostics (Push subscription: active ...) so you can confirm whether the backend has registered your device.

After this, the Bun backend can send push notifications even when the PWA is not open.

Reverse proxy for HTTPS

If you deploy this compose stack on a server, put it behind an HTTPS reverse proxy (for example Caddy, Nginx, or Traefik) and route your domain to this app.

iOS web push will not work on plain HTTP.

API endpoints (backend)

  • GET /api/config - public config including VAPID public key
  • GET /api/health - backend health and poll status
  • GET /api/events - latest fetched meetup snapshot
  • POST /api/subscribe - register push subscription
  • POST /api/unsubscribe - remove push subscription
  • POST /api/subscription-status - verify if a given device endpoint is registered
  • POST /api/test-push - send test push
  • POST /api/check-now - trigger immediate poll
  • POST /api/reset-seen - clear seen event IDs

Notes

  • data/notifier.db is created automatically.
  • The backend exchanges IDA_API_USERNAME + IDA_API_PASSWORD_B64 for a bearer token and refreshes it automatically before expiry.
  • Stale subscriptions are removed when push endpoints return 404/410.
  • Notifications can be filtered per subscriber by city name, matched against meetup.location.city.
  • Notification click opens a deep link to https://ida.dk/arrangementer-og-kurser/arrangementer/{meetupNumber} when available.
  • On first backend poll, current events are used as baseline and no push is sent.

About

๐Ÿ”” PWA that notifies you when new IDA events appear in your area.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors