Skip to content

feat: implement environment configuration and validation#103

Open
Vivian-04 wants to merge 2 commits intoMissBlue00:mainfrom
Vivian-04:feat/backend-env-validation
Open

feat: implement environment configuration and validation#103
Vivian-04 wants to merge 2 commits intoMissBlue00:mainfrom
Vivian-04:feat/backend-env-validation

Conversation

@Vivian-04
Copy link
Copy Markdown

PR #2 Backend: Implement environment configuration and validation
Description
This PR implements a robust environment configuration and validation module for the NestJS API using @nestjs/config and zod.

Key changes:

Created
apps/api/src/config/env.validation.ts
with a Zod schema for mandatory environment variables.
Integrated ConfigModule.forRoot() into
AppModule
with strict validation.
Implemented a "fail-fast" policy: the application logs a clear error and exits immediately during startup if required environment variables are missing or invalid.
Updated
.env.example
to document all required variables.
Required Variables:

DATABASE_URL
JWT_SECRET
TREASURY_PRIVATE_KEY
STELLAR_RPC_URL
BTC_NODE_URL
ETH_NODE_URL
REDIS_URL

Type of change
New feature (non-breaking change which adds functionality)
How Has This Been Tested?
I ran the following tests to verify the changes:

Build Verification: Ran pnpm --filter api run build to ensure the project compiles correctly with the new configuration module.
Unit Tests: Ran pnpm --filter api run test to ensure existing tests pass.
Fail-Fast Verification: Started the application without environment variables and verified it exits with a detailed error message listing missing fields.
Startup Verification: Started the application with valid environment variables and verified it initializes correctly.
Test Configuration:

Node.js: v24.14.0
Package Manager: pnpm v10.33.0
OS: Windows
Checklist:
My code follows the style guidelines of this project
I have performed a self-review of my own code
I have commented my code, particularly in hard-to-understand areas
I have made corresponding changes to the documentation
My changes generate no new warnings
I have added tests that prove my fix is effective or that my feature works
New and existing unit tests pass locally with my changes
Any dependent changes have been merged and published in downstream modules

Closes #2

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 24, 2026

@Vivian-04 is attempting to deploy a commit to the missblue00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 24, 2026

@Vivian-04 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

@MissBlue00
Copy link
Copy Markdown
Owner

@Vivian-04 Resolve conflicts and ensure CI/CD checks pass, thank you!

@Vivian-04
Copy link
Copy Markdown
Author

Vivian-04 commented Mar 27, 2026 via email

@Vivian-04
Copy link
Copy Markdown
Author

Kindly check and let me know.
Thank youu!

@MissBlue00
Copy link
Copy Markdown
Owner

@Vivian-04 The ci/cd checks is still failing

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 configuration and validation

2 participants