Skip to content

fix(frontend): replace hardcoded localhost with environment variable#14

Merged
DevanshuNEU merged 1 commit into
OpenCodeIntel:mainfrom
DevanshuNEU:fix/issue-5-hardcoded-localhost-url
Nov 26, 2025
Merged

fix(frontend): replace hardcoded localhost with environment variable#14
DevanshuNEU merged 1 commit into
OpenCodeIntel:mainfrom
DevanshuNEU:fix/issue-5-hardcoded-localhost-url

Conversation

@DevanshuNEU

Copy link
Copy Markdown
Collaborator

Fixes #5 - Frontend uses hardcoded localhost API URL

Problem

Frontend had hardcoded http://localhost:8000 in Dashboard.tsx, causing production deployments to fail when the frontend tried to call localhost instead of the Railway backend URL.

Solution

  • Created centralized API config (src/config/api.ts)
  • Reads from VITE_API_URL environment variable
  • Falls back to localhost:8000 for local development
  • Added .env.example for documentation

Testing

  • Docker build successful
  • TypeScript compilation passed
  • No other hardcoded URLs found in codebase

Files Changed

  • frontend/src/config/api.ts (new)
  • frontend/src/components/Dashboard.tsx (updated import)
  • frontend/.env.example (new)

- Created centralized API config in src/config/api.ts
- Reads from VITE_API_URL env var with localhost fallback
- Updated Dashboard.tsx to import from config
- Added frontend/.env.example for documentation
- Resolves production deployment issue where frontend tried to call localhost

Fixes #5
@DevanshuNEU DevanshuNEU merged commit 161468e into OpenCodeIntel:main Nov 26, 2025
4 checks passed
@DevanshuNEU DevanshuNEU added type: enhancement New feature or request area: frontend Frontend/UI labels Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: frontend Frontend/UI type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Frontend uses hardcoded localhost API URL

1 participant