VITE_. Any variable without that prefix is available during the build process only and is never included in the compiled bundle.
Creating the environment file
.env when running npm run dev or npm run build. For environment-specific overrides you can also create .env.production or .env.development files; Vite merges them in order of precedence.
Variable reference
Base URL of the ATT backend API. All API requests from the browser are sent to this address.The Nginx configuration in this repository proxies requests with the
/api/ prefix to the upstream service. Set this variable to the origin and path prefix that the browser should call.Development default: http://localhost:80Production example: https://api.your-domain.comDevelopment vs production
Development
When runningnpm run dev, Vite’s dev server reads .env (and .env.development if present). The default value of VITE_API_BASE_URL=http://localhost:80 assumes the backend is available on the same machine.
.env (development)
Production
For a production Docker build, setVITE_API_BASE_URL to the publicly reachable URL of the backend before building:
.env (production)
If you are deploying multiple environments (staging, production) from the same codebase, build a separate image for each environment with its own
.env file, or use a CI/CD pipeline that injects the correct values at build time.Accessing variables in application code
Inside the React application, anyVITE_ variable is available via:
Security considerations
- Every
VITE_variable is public — it is visible to anyone who can view the compiled JavaScript. Never put secrets, private keys, or credentials inVITE_variables. - The JWT auth token is stored in
localStorageafter login and is not an environment variable. - Backend secrets (database credentials, API keys used server-side) belong in the backend service’s own environment, not in this file.
