docs: push notifications setup & env guide#52
Open
soumya813 wants to merge 3 commits intosubh05sus:mainfrom
Open
docs: push notifications setup & env guide#52soumya813 wants to merge 3 commits intosubh05sus:mainfrom
soumya813 wants to merge 3 commits intosubh05sus:mainfrom
Conversation
|
@soumya813 is attempting to deploy a commit to the Subhadip Saha's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
|
Please Fix ./components/notification-settings.tsx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements browser push notifications for CodeNearby using Firebase Cloud Messaging (FCM). It includes:
Client-side: permission flow, token management, foreground handlers, and UI components to prompt users and manage notification preferences
Server-side: helper to send pushes with Firebase Admin, guarded initialization when credentials are missing, and API routes to persist tokens & settings
Integrations: wired notifications on friend requests, gathering chat, and direct messages; guarded database/firebase usage to avoid startup crashes when envs are missing
Actions for the author / maintainer (priority order)
-Provide secrets for real testing
-Add Firebase client vars to environment for the deployment
-Add Firebase Admin credentials: FIREBASE_PROJECT_ID, FIREBASE_CLIENT_EMAIL, FIREBASE_PRIVATE_KEY (replace newlines with \n when pasting into env).
-Ensure MONGODB_URI points to a running DB.
-Service worker config (required)
-Replace the placeholders in [firebase-messaging-sw.js] with real Firebase client config at build time, or add a build script that generates [firebase-messaging-sw.js] from NEXT_PUBLIC_* env vars (I can implement this if you want).
-Validate end-to-end flow locally
Run: npm run dev
-Sign in, go to Profile → Edit → Notifications, enable permissions.
-From another account or via app flows, trigger:
Direct message to a user
Friend request
Gathering chat message
Verify notifications appear in foreground and background and that notification clicks navigate correctly.
Security & review
Confirm no secrets were committed (PR contains placeholders only).
Review server send logic in lib/push-notifications-server.ts for payload shape & error handling.
Optionally run a linter/TS check: npm run lint / npm run build.