Skip to content

feat: add build-time environment variable validation - #152

Merged
AlAfiz merged 3 commits into
Axionvera:mainfrom
Hallab7:feat/build-time-env-validation
Apr 30, 2026
Merged

AlAfiz merged 3 commits into
Axionvera:mainfrom
Hallab7:feat/build-time-env-validation

Conversation

@Hallab7

@Hallab7 Hallab7 commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Implement strict validation for all environment variables using zod and @t3-oss/env-nextjs to prevent runtime failures from missing or malformed configuration.

  • Add zod and @t3-oss/env-nextjs dependencies
  • Create src/env.mjs with validation schema for all NEXT_PUBLIC_ variables
  • Validate SOROBAN_RPC_URL and HORIZON_URL as proper URLs
  • Validate contract IDs with regex (must start with 'C' and be 56 chars)
  • Validate STELLAR_NETWORK as enum (testnet/mainnet/futurenet)
  • Import env.mjs in next.config.mjs to enforce validation during build and dev
  • Build now fails immediately with clear errors for invalid/missing variables

closes #61

@drips-wave

drips-wave Bot commented Apr 25, 2026

Copy link
Copy Markdown

@Hallab7 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

@AlAfiz
AlAfiz merged commit c95b478 into Axionvera:main Apr 30, 2026
0 of 3 checks passed
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.

Configure robust Environment Variable Validation at build time

2 participants