feat: BackendStatusBanner + backend API contract docs - #32
Merged
Conversation
feat: BackendStatusBanner + backend API contract docs
|
@pharuq411 is attempting to deploy a commit to the Prisca's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Closes #12
Two deliverables:
BackendStatusBanner component — a dismissible red banner that appears on every page when the Octraban indexer API is unreachable.
docs/api.md — a complete, human-readable contract for every HTTP/SSE endpoint the frontend consumes.
Changes
src/components/BackendStatusBanner.tsx (new)
Polls GET /api/health on mount and every 30 s using AbortSignal.timeout(4000).
Renders a role="alert" banner only when the backend is down and the user hasn't dismissed it.
Shows the configured VITE_INDEXER_URL and links to the backend repo.
No external dependencies — plain fetch + React state.
src/App.tsx
Imports and mounts above the block so it appears on every route.
docs/api.md (new)
Documents all 30+ endpoints consumed by src/api.ts, grouped by resource.
Each entry covers: method + path, query params, request body (where applicable), and a typed response example.
Covers SSE streams (/sub-invocations/stream, /transactions/:txHash/status/stream).
Includes a standard error-response section and a quick-reference SSE table.
Testing
With the backend stopped: the banner appears within ~4 s of page load.
Clicking × dismisses it for the session.
With the backend running (npm run dev in octraban_backend): banner never appears.
npm run build passes — no new type errors.