-
Notifications
You must be signed in to change notification settings - Fork 8
Refactor email service to be handled server side #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@LogicalGuy77 is attempting to deploy a commit to the lighthouse-storage Team on Vercel. A member of the Team first needs to authorize it. |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
@arpitB-dev hi, could you please review it and merge when you get time? |
User description
The email sending logic has been moved to a secure server-side API route at
send-email.js
. The client-side sendEmail function now calls this API route, so your API key is no longer exposed to the client.In Next.js, any environment variable prefixed with NEXT_PUBLIC_ is embedded into the client-side JavaScript bundle and is accessible in the browser. This means anyone inspecting frontend code could see the API key
PR Type
Enhancement, Fixes #22
Description
Move email sending logic to secure server-side API endpoint
Remove client-side API key exposure vulnerability
Improve error handling and validation
Update environment variable naming convention
Diagram Walkthrough
File Walkthrough
send-email.js
Create secure server-side email API endpoint
pages/api/send-email.js
emailService.js
Refactor client-side email service to use API
utils/services/emailService.js
.env.example
Update environment variable naming convention
.env.example
NEXT_PUBLIC_BREVO_API_KEY
toNEXT_PUBLIC_BREVO_API