Skip to content

Phase 8: Native push, deep links, offline sync, LLM locale - #9

Draft
maouM-cmd wants to merge 8 commits into
mainfrom
cursor/phase-8-native-push-8ba0
Draft

Phase 8: Native push, deep links, offline sync, LLM locale#9
maouM-cmd wants to merge 8 commits into
mainfrom
cursor/phase-8-native-push-8ba0

Conversation

@maouM-cmd

Copy link
Copy Markdown
Owner

Summary

Implements Phase 8 for Prompt Dojo: localized push notifications, native FCM support, deep links, Background Sync, and locale-aware LLM generation.

Push i18n

  • Added push-messages.ts with sendLocalizedPush() using recipient preferred_locale
  • Added pushNotifications message namespace (ja/en)
  • Updated comment, rating, and challenge-approval push triggers
  • Push URLs now include locale prefix (e.g. /en/submissions/42)

Native push backend

  • Added device_tokens table and CRUD helpers in db.ts
  • New POST/DELETE /api/push/register-device for Capacitor FCM tokens
  • Extended push.ts with firebase-admin FCM multicast (optional when env vars set)
  • Web Push unchanged; stale subscription/token cleanup on 410/404

Capacitor client

  • Added @capacitor/core, @capacitor/app, @capacitor/push-notifications
  • NativePushRegistrar auto-registers tokens on native platforms
  • capacitor-deeplink.ts handles prompt-dojo:// and https deep links
  • PushNotifyButton supports both web and native subscribe flows

Deep links

  • Added .well-known/apple-app-site-association and assetlinks.json
  • Updated mobile/README.md with Firebase, Universal Links, and App Links setup

Background Sync

  • sw.js sync handler flushes IndexedDB offline queue
  • registerBackgroundSync() called after enqueue in PromptForm/CommentSection
  • Existing online event sync retained as fallback

LLM locale

  • evaluatePromptWithLLM and generateChallengeWithLLM accept locale
  • Submission creation uses user preferred_locale for auto + LLM evaluation
  • Challenge gen API and button pass locale

Documentation

  • REQUIREMENTS.md v8.0
  • render.yaml Firebase env vars

Verification

  • npm run build — pass
  • npm run lint — pass

Manual checks

  • Web push shows localized title/body for EN users
  • DevTools offline → queue → Background Sync or online recovery
  • /en AI challenge generation returns English content
  • Native push requires Firebase credentials + cap add (see mobile/README.md)
Open in Web Open in Cursor 

cursoragent and others added 8 commits July 1, 2026 06:10
New Next.js app for community prompt writing practice:
- Challenge list with seed data and admin CRUD
- Real-time rule-based prompt structure scoring
- Star ratings from other users with leaderboard
- Session-based nickname auth, history, sharing
- Docker and Render deployment config

Co-authored-by: maouM-cmd <maouM-cmd@users.noreply.github.com>
…eval, OAuth, ads

- Comments and reports with auto-hide after 3 reports
- Admin moderation for submissions, pending challenges, reports
- User-submitted challenges with pending/approve workflow
- OpenAI LLM scoring on submission with daily rate limit
- Google OAuth via NextAuth v5 alongside nickname sessions
- AdSlot on home, challenge detail, leaderboard pages
- Updated docs, privacy policy, and Render env vars

Co-authored-by: maouM-cmd <maouM-cmd@users.noreply.github.com>
…ge gen, email auth, push

- Comment threads with parent_id and reply UI (max 2 levels)
- GitHub and Apple OAuth via refactored NextAuth providers
- LLM challenge generation API and UI for users and admin
- Email/password register and login with bcrypt
- Web push notifications on comment, rating, challenge approval
- Service worker, push subscribe API, history page notify button
- Updated REQUIREMENTS, README, render.yaml, privacy policy

Co-authored-by: maouM-cmd <maouM-cmd@users.noreply.github.com>
- Add email verification flow with SMTP mailer and auth tokens
- Add password reset via forgot/reset pages and APIs
- Enforce email verification for submissions, comments, and challenges
- Support recursive comment threads up to 5 levels deep
- Add PWA manifest, icons, and shared service worker registration
- Update REQUIREMENTS.md and privacy policy for Phase 4

Co-authored-by: maouM-cmd <maouM-cmd@users.noreply.github.com>
- Add categories, tags, and challenge filtering (DB, API, UI)
- Integrate next-intl with ja/en routing and LocaleSwitcher
- Extend service worker with cache strategy and offline page
- Localize mail templates and main auth/home UI
- Update REQUIREMENTS.md to v5.0

Co-authored-by: maouM-cmd <maouM-cmd@users.noreply.github.com>
- Add api-errors.ts and mapApiError for localized API error codes
- Extend errorCode coverage across auth, admin, session, and CRUD routes
- Complete UI i18n for auth pages, submission detail, and shared components
- Add English terms/privacy content via LegalContent component
- Implement IndexedDB offline queue with OfflineSyncProvider and SyncBadge
- Add Capacitor mobile shell (mobile/) with setup README
- Update REQUIREMENTS.md to v6.0

Co-authored-by: maouM-cmd <maouM-cmd@users.noreply.github.com>
- Add mapApiMessage for localized API success messageCode responses
- Migrate report, register, and challenges APIs to messageCode/errorCode
- Localize AdminDashboard, ReportButton, PushNotifyButton, LLMEvaluationDisplay, AdSlot
- Add locale-aware prompt evaluator and evaluate API
- Add PWA icons and per-locale manifest.webmanifest route
- Update REQUIREMENTS.md to v7.0

Co-authored-by: maouM-cmd <maouM-cmd@users.noreply.github.com>
- Add push-messages.ts for localized push titles and locale-prefixed URLs
- Add device_tokens table, register-device API, and FCM via firebase-admin
- Add NativePushRegistrar, Capacitor deeplink handler, and push UI updates
- Add .well-known files for Universal Links and App Links
- Add Background Sync in sw.js and registerBackgroundSync in offline queue
- Localize LLM evaluator and challenge generator by user locale
- Update REQUIREMENTS.md to v8.0, render.yaml, and mobile README

Co-authored-by: maouM-cmd <maouM-cmd@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants