sip-protocol / sip-protocol/sipher

[tech-debt] Centralize `/api/health` URL for FE Vercel migration

Open
#246 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority:low tech-debt
Dominant language
TypeScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Follow-up from Wave 2a Cluster E1 (#219 connection-quality indicator). Code-quality reviewer flagged forward-compat concern.

Current state

app/src/components/ConnectionQualityIndicator.tsx:11 hardcodes the ping endpoint:

```ts
const ENDPOINT = '/api/health'
```

Today the FE is served from the same VPS as the agent at sipher.sip-protocol.org, so the same-origin /api/health request reaches the backend. Works.

Future risk

Per ~/.claude/projects/-Users-rector-local-dev-sip-protocol/memory/project_fe-vercel-migration.md, the SIPHER FE is planned to migrate to Vercel. After migration, the FE serves from *.vercel.app while the backend stays at sipher-api.sip-protocol.org. A relative /api/health request from the Vercel-served FE will:

  • Hit Vercel's 404 (FE host has no /api/health route)
  • Indicator perpetually shows red
  • Misleading UX (backend is fine; the URL is just wrong)

Proposed fix

Centralize the backend base URL. Either:

  • Use an existing apiFetch helper if one provides a base URL abstraction (check app/src/api/client.ts)
  • Or expose import.meta.env.VITE_API_BASE (already used elsewhere for API calls) and build ${API_BASE}/api/health

Audit other hardcoded /api/* URLs in app/src/components/ and app/src/views/ for the same risk.

Source

Wave 2a Cluster E1 code-quality review minor finding #6.

Priority

Low — works correctly today. Becomes Important when Vercel migration starts.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with app/src/components/ConnectionQualityIndicator.tsx:11 and inspect app/src/api/client.ts, then search app/src/components/ and app/src/views/ for hardcoded /api/* URLs. Check how VITE_API_BASE is already used elsewhere and centralize the health request through the existing URL approach. Done means the indicator uses the backend base URL and the frontend API URL audit is addressed without breaking current same-origin behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
66/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.