Notifications
Email (SES)
Transactional email is sent via AWS SES for:
- Challenge issued / revoked / accepted
- Game start and game end (with expanded end-game details)
- Tournament start, end, and removal
Users can disable most email categories in settings.all.notifications; push notifications for challenges and tournaments follow the same preference flags where applicable (challenge/game push still sends regardless of email toggles for challenges).
Language follows the recipient's language field (locales/*/apback.json). At send time, if the user's language is not yet registered in i18next, notifications fall back to English while the stored preference is kept unchanged — adding a locale later will apply automatically for users who already selected that language.
Web push
VAPID keys (VAPID_PUBLIC_KEY, VAPID_PRIVATE_KEY) enable browser push. Each device/browser subscription is stored as its own PUSH record (sk: <userid>#<subscriptionKey>). Auth queries:
save_push— register or refresh this device (upserts onePUSHrecord; setsmayPushon the user)delete_push— unregister this device (pars.endpoint; clearsmayPushwhen no subscriptions remain)set_push({ state: false })— unregister all devices for the userset_push({ state: true })— sets user preference only; still requiressave_pushto register a devicetest_push— send a test notification to all registered devices
When a push fails with HTTP 404 or 410 (stale endpoint), only that subscription record is deleted.
Your turn batching
The yourturn Lambda runs on a schedule (14:00 and 22:00 UTC, prod only) via EventBridge. It scans active games and sends batched "your turn" emails — not on every move.
Implementation: utils/yourturn.ts.
Push topics
Push messages use topics such as challenges and game-related channels. See sendPush() usage in api/abstractplay.ts.
Related
- Getting started — VAPID env vars
- Deployment
- Architecture —
yourturnLambda