feat: add environment variable validation and update documentation#23
feat: add environment variable validation and update documentation#23Shreenath-14 wants to merge 6 commits intoZenYukti:mainfrom
Conversation
feat: add environment variable validation and update documentation
|
Yay! You're officially a Contributor! 🎉Huge thanks for opening this Pull Request. Being a contributor to ZenYukti is a big deal, and we’re excited to have you on board. Next Steps:
|
|
Hi Team ! I've implemented the environment variable validation as requested in Issue #5. I've also updated the README with a configuration table. All local tests and CI checks passed. Looking forward to your feedback! |
backend/database/schema.sql
Outdated
| ALTER TABLE volunteers ENABLE ROW LEVEL SECURITY; | ||
|
|
||
| -- Profiles policies | ||
| -- Profiles policies |
There was a problem hiding this comment.
Please revert these changes from this file.
because, it looks like some comments were accidentally duplicated (e.g., -- Profiles policies) nd some whitespace was changed...
we should keep this PR focused strictly on the environment variable validation to keep the git history clean
frontend/.env.example
Outdated
| VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... | ||
|
|
||
| # Production values: | ||
| # Production values: (if Locally running then it should be https://localhost:5000 and ws://localhost:5000 ) |
There was a problem hiding this comment.
move the localhost examples out from under the # Production values header
it's a bit confusing for new contributors to see local URLs listed under a "Production" heading
previous one was good to me
There was a problem hiding this comment.
thanks for the detailed validation logic!
I have a small style request: could we remov the numbered comments (// 1., // 2.) and the emojis (❌) from the error message?
we try to keep our backend logs as clean and standard as possible for better compatibility with different terminal and logging envirnments
it also keeps the file structure a bit more consistent with the rest of our codebase
There was a problem hiding this comment.
yes sure you can remove the numerical comments
There was a problem hiding this comment.
you're expected to do that so that we can proceed with the PR, and kindly rebase at end
|
also why this "feat: typing indicater for better UI experience" commit is here, in thsi PR? this is completely irrelevant as per the target of this PR! I'd suggest you - probably rebase it, avoid "revert" or "do not merge" to keep the commit history clean for future visitors. |
Shreenath-14
left a comment
There was a problem hiding this comment.
I have done the changes you told me just review it and let me know
|
Hi @ayushHardeniya , |
|
Hi @Shreenath-14, can you tell me what this PR is actually about! I'd suggest to filter it out, and stick with key purpose! |
|
Sir actully this PR was my first PR thats why its been mess please ignore I'll explain.
also for previous you said to make some style changes which has been done and also added detailed readme changes |

Description
Implemented a "fail-fast" environment variable validation system for the backend. Previously, the server would start with missing or malformed .env variables, leading to silent failures and a confusing developer experience. Now, the server validates all required keys (Supabase, Port, Frontend URL) upon startup and provides clear error messages if any are invalid. Closes #5.
Type of Change
How Has This Been Tested?
Startup Validation: Verified that the server crashes with a specific error message if PORT is not a number or if SUPABASE_URL is an invalid URL.
CORS Verification: Confirmed that updating the FRONTEND_URL in the .env correctly resolves browser console errors and allows the frontend to fetch room data.
Database Connectivity: Verified that valid anonymous sign-ins and message persistence work after correctly configuring Supabase keys and RLS policies.
Screenshots
Checklist
Additional Information
Updated the CORS middleware to dynamically use the FRONTEND_URL from the environment configuration to prevent port mismatch errors between development environments (e.g., port 3000 vs 5173).
Learning Outcomes
I learned how to implement centralized configuration validation in Node.js/TypeScript and how to manage Row-Level Security (RLS) policies in Supabase for anonymous user sessions.