[Backend] Add fail-fast environment variable validation on server startup
Overview
When starting the backend service without required environment variables (such as DATABASE_URL, JWT_SECRET, or SOROBAN_RPC_URL), the app boots partially and only crashes later when a route or worker accesses an undefined config value.
Problem
- Missing or malformed environment variables lead to confusing runtime stack traces instead of a clear startup diagnostic message.
Proposed Changes
- Create
backend/src/config/env.tsusing Zod (or a lightweight validator) to validate required environment variables at startup. - Log a clear table of missing/invalid variables and exit with code 1 in production if required variables are absent.
Acceptance Criteria
- [ ] Validates
DATABASE_URL,PORT,NODE_ENV, andSOROBAN_RPC_URL. - [ ] Provides sensible defaults for development and test environments.
- [ ] Unit test verifying validator error reporting on missing required keys.
@CollinsKRO has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
Hi Maintainer, I can fix this pls assign. ETA 5hrs
ℹ️ Repo Maintainers: To accept this application, review their application or assign @CollinsKRO to this issue.
@Godfrey-Delight has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
Hi maintainer! I’d love to work on this issue if it’s still available. I have a good understanding of the requirements and would be happy to implement the solution. Thanks for considering my request!
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Godfrey-Delight to this issue.
@Yilkash has applied to work on this issue as part of the Stellar Wave Program's 10th wave.
Can i work on this?
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Yilkash to this issue.
Congratulations, @Yilkash! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.
🧑💻 @Yilkash: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
This issue has been completed by @Yilkash as part of the Stellar Wave Program's 10th Wave 🥳
😎 @Yilkash: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.