Skip to content

Features/enviroment#66

Merged
Tybravo merged 3 commits into
SwiftChainn:mainfrom
samad13:features/enviroment
Jul 1, 2026
Merged

Features/enviroment#66
Tybravo merged 3 commits into
SwiftChainn:mainfrom
samad13:features/enviroment

Conversation

@samad13

@samad13 samad13 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary of Implementation

  1. Installed Zod as a dependency for env validation
  2. Created src/config/env.ts to:
    • Load .env variables using dotenv
    • Validate variables with Zod schema (includes defaults, type coercions, and strict validation rules for all environment variables in .env.example)
    • Fail fast on validation errors with detailed logging
  3. Updated existing files to use validated env variables:
    • src/config/database.ts : uses env.MONGODB_URI instead of process.env
    • src/app.ts : uses env.CORS_ORIGIN , env.RATE_LIMIT_WINDOW_MS , and env.RATE_LIMIT_MAX_REQUESTS instead of hardcoded/process.env values
    • src/server.ts : uses env.PORT and env.NODE_ENV instead of process.env
  4. Created .env file from .env.example
  5. Fixed Zod 4.x compatibility (using error.issues instead of error.errors )
  6. Verified everything works with passing tests and lint check!
    The implementation ensures all environment variables are valid at startup, fails fast on invalid config, and follows all project conventions!
    Closes Backend: Implement environment variables validation using dotenv and Zod #4

@drips-wave

drips-wave Bot commented Jul 1, 2026

Copy link
Copy Markdown

@samad13 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Tybravo Tybravo merged commit a7be9da into SwiftChainn:main Jul 1, 2026
1 check failed
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.

Backend: Implement environment variables validation using dotenv and Zod

2 participants