Add centralized API configuration with localhost fallback - #12
Merged
pmca31 merged 5 commits intoFeb 11, 2026
Merged
Conversation
- Create config/api.js with getApiUrl utility - Update all components to use centralized API config - Add REACT_APP_API_BASE_URL env var support - Maintain backward compatibility with REACT_APP_CODESPACE_NAME - Update .env and .env.example with new configuration docs Co-authored-by: pmca31 <6774003+pmca31@users.noreply.github.com>
- Document REACT_APP_API_BASE_URL as recommended approach - Explain configuration priority and fallback behavior - Update setup instructions for local development - Add examples for different environments Co-authored-by: pmca31 <6774003+pmca31@users.noreply.github.com>
When both REACT_APP_API_BASE_URL and REACT_APP_CODESPACE_NAME are set, only the first is used due to priority. Commenting out the Codespaces variable to make it clear that the localhost config is active. Co-authored-by: pmca31 <6774003+pmca31@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] WIP Address feedback on registration validation PR
Add centralized API configuration with localhost fallback
Feb 11, 2026
…4d3c-b8ef-75364c55a593
pmca31
marked this pull request as ready for review
February 11, 2026 19:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hard-coded API URLs using
process.env.REACT_APP_CODESPACE_NAMEbroke local development withhttps://undefined-8000.app.github.dev/...when the env var was unset.Changes
Created
src/config/api.js: Centralized configuration with priority-based resolution:REACT_APP_API_BASE_URL(explicit URL, recommended)REACT_APP_CODESPACE_NAME(Codespaces, backward compatible)http://localhost:8000Updated all components to use
getApiUrl(): Activities, Leaderboard, Teams, Users, WorkoutsEnvironment configuration: Added
REACT_APP_API_BASE_URLto.envand.env.examplewith documentationDocumentation: Updated
FRONTEND_README.mdwith configuration examples for local, Codespaces, and production environmentsUsage
App now works locally without requiring environment variables.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.