Skip to content

feat: make frontend backend API URL configurable via environment variable#55

Open
Rahul-2k4 wants to merge 1 commit into
chaoss:mainfrom
Rahul-2k4:feat/frontend-api-base-url-env
Open

feat: make frontend backend API URL configurable via environment variable#55
Rahul-2k4 wants to merge 1 commit into
chaoss:mainfrom
Rahul-2k4:feat/frontend-api-base-url-env

Conversation

@Rahul-2k4
Copy link
Copy Markdown

Summary

The frontend api.ts hardcodes the backend API URL as http://127.0.0.1:5000/, which prevents deployment to hosted environments where the backend runs at a different origin (e.g., PythonAnywhere).

This PR makes the URL configurable via the NEXT_PUBLIC_API_BASE_URL environment variable, falling back to the local default when unset.

Related to #8 – deployment readiness.

Changes

  • frontend/services/api.ts: Read NEXT_PUBLIC_API_BASE_URL from process.env with fallback to http://127.0.0.1:5000/
  • frontend/.env.example: Document the new variable
  • frontend/.gitignore: Explicitly list env files (instead of broad .env* glob) so .env.example can be committed

Usage

Local development (default -- no action needed):

npm run dev

Point at a deployed backend:

cp frontend/.env.example frontend/.env.local
# Edit NEXT_PUBLIC_API_BASE_URL in .env.local
npm run dev

…BASE_URL

Signed-off-by: Rahul Tripathi <rahul@Rahuls-Mac-mini.local>
@Rahul-2k4 Rahul-2k4 force-pushed the feat/frontend-api-base-url-env branch from ad87c0d to 43fc381 Compare May 13, 2026 19:19
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.

1 participant