Skip to content

refactor: migrate REACT_APP_ env vars to VITE_ prefix #347

@AugustoL

Description

@AugustoL

Summary

Migrate all REACT_APP_* environment variables to Vite's native VITE_* prefix convention.

Motivation

The project uses Vite as its bundler but still follows the Create React App convention of REACT_APP_* prefixed env vars. This requires each variable to be manually added to the define map in vite.config.ts for build-time replacement. Vite natively exposes VITE_* variables via import.meta.env without any extra configuration.

Current State

Variables in vite.config.ts define map:

  • REACT_APP_COMMIT_HASH
  • REACT_APP_GITHUB_REPO
  • REACT_APP_VERSION
  • REACT_APP_OPENSCAN_NETWORKS
  • REACT_APP_OPENSCAN_GROQ_AI_URL
  • REACT_APP_OPENSCAN_WORKER_URL

All accessed via process.env.REACT_APP_* which Vite replaces at build time through the define option.

Proposed Solution

  1. Rename all env vars from REACT_APP_* to VITE_*
  2. Replace process.env.REACT_APP_* access with import.meta.env.VITE_*
  3. Remove the manual define entries from vite.config.ts (Vite handles VITE_* automatically)
  4. Update CI/CD configs (GitHub Actions, Netlify) to use the new variable names
  5. Update deployment scripts (scripts/build-production.sh, scripts/build-staging.sh)
  6. Update documentation if any references exist

Acceptance Criteria

  • All REACT_APP_* variables renamed to VITE_*
  • Code uses import.meta.env.VITE_* instead of process.env.REACT_APP_*
  • define map in vite.config.ts cleaned up (only non-env entries remain)
  • CI/CD and deployment configs updated
  • Application works correctly in dev, staging, and production

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions