Next.js frontend application for StableRoute — the Stellar liquidity routing protocol. It provides user interfaces for obtaining path routing quotes, managing liquidity pairs, viewing stats, configuring API keys and webhooks, browsing audit logs, adjusting developer settings, and reading endpoint documentation.
- Next.js 15 (App Router) with React 19
- TailwindCSS for styling
- A comprehensive set of routing, management, and audit log pages integrated with the StableRoute backend.
Each route is defined under src/app and connects to its respective UI page:
/(page.tsx): Home landing page with navigation links and quick CTAs./pairs(pairs/page.tsx): Lists registered currency pairs on the router./pairs/new(pairs/new/page.tsx): Form interface to register a new currency pair./quote(quote/page.tsx): Form interface to request currency routing path quotes. Inputs use the sharedTextFieldcomponent for accessible labels,aria-describedby, and per-field validation errors./stats(stats/page.tsx): Status dashboard showing system metrics and polling the backend./admin(admin/page.tsx): Control center to pause or unpause router activity./api-keys(api-keys/page.tsx): Dashboard to create, list, and revoke API keys./events(events/page.tsx): Audit log page rendering the system event log history./webhooks(webhooks/page.tsx): Webhook manager for listing and adding event subscribers./settings(settings/page.tsx): User settings interface hosting the light/dark appearance toggle./docs(docs/page.tsx): Documentation page describing the API endpoints and usage./about(about/page.tsx): Static about page describing the protocol.
Reusable building blocks live under src/components and are imported by route pages:
| Component | Purpose |
|---|---|
TextField |
Accessible labeled inputs with aria-describedby error wiring |
Button |
Primary actions; supports asChild for link-style buttons |
IconButton |
Icon-only controls with required aria-label |
PageHeading |
Consistent page title + optional description |
ConfirmDialog |
Modal confirmation with focus trap and Escape to dismiss |
EmptyState |
Placeholder when a list has no rows |
StatTile |
Metric card used on /stats |
TimeAgo |
Relative timestamps with aria-label |
ThemeToggle |
Light/dark appearance switch persisted in localStorage |
ToastProvider |
App-wide toast notifications |
KeyboardShortcutsHelp |
? overlay listing keyboard shortcuts |
CommandPalette |
Cmd/Ctrl+K route jump palette |
Data fetching helpers (apiClient, useApi, useList) live in src/lib.
The shared footer keeps the StableRoute tagline visible on every page, renders the current copyright year dynamically, and links to /docs, /about, and the StableRoute Discord community.
The frontend communicates with the StableRoute API backend.
NEXT_PUBLIC_STABLEROUTE_API_BASE: Specifies the base URL of the StableRoute API backend (defaults tohttp://localhost:3001if unset).
/api/v1/pairs: Lists registered pairs (GET) and registers new pairs (POST)./api/v1/quote: Requests path routing quotes for (source, destination, amount) triples (GET)./api/v1/stats: Retrieves system performance and routing metrics (GET)./api/v1/admin/status: Retrieves router paused status (GET)./api/v1/admin/pause//api/v1/admin/unpause: Pauses and unpauses routing activity (POST)./api/v1/api-keys: Creates (POST), lists (GET), and revokes (DELETEat/api/v1/api-keys/:prefix) API keys./api/v1/events: Retrieves system event audit logs (GET)./api/v1/webhooks: Creates (POST), lists (GET), and revokes (DELETEat/api/v1/webhooks/:id) webhook subscriptions.
Stellar asset codes entered through the new-pair form are trimmed, validated as
1-12 ASCII letters or numbers, uppercased before submission, and compared after
normalization so duplicate pairs such as usdc and USDC cannot be registered.
- Node.js 18+
- npm
- Clone the repo and enter the directory:
git clone <repo-url> && cd stableroute-frontend
- Install dependencies:
npm install
- Build and test:
npm run build npm test - Run locally:
App:
npm run dev
http://localhost:3000.
By default the dashboard calls http://localhost:3001. To target another StableRoute API instance:
# Unix/macOS
export NEXT_PUBLIC_STABLEROUTE_API_BASE=https://staging-api.example.com
# Windows PowerShell
$env:NEXT_PUBLIC_STABLEROUTE_API_BASE="https://staging-api.example.com"
npm run devThe client reads this value in src/lib/apiClient.ts. Restart the dev server after changing env vars.
- Install & typecheck
npm install npm run build
- Run the full Jest suite
npm test - Watch mode while editing tests
npm run test:watch
- Run a single test file
npx jest src/app/quote/page.test.tsx --runInBand
- Lint
npm run lint
| Symptom | Fix |
|---|---|
API calls fail with ECONNREFUSED |
Start the StableRoute backend or set NEXT_PUBLIC_STABLEROUTE_API_BASE |
| Jest OOM on Windows | Run with NODE_OPTIONS=--max-old-space-size=4096 npx jest … |
| Fork PR CI shows action required | A maintainer must approve GitHub Actions for fork PRs |
| Script | Description |
|---|---|
npm run dev |
Start dev server (Next.js) |
npm run build |
Production build |
npm run start |
Run production server |
npm test |
Run Jest tests |
npm run test:watch |
Run Jest in watch mode |
npm run lint |
Next.js ESLint |
Dynamic list updates (loading → loaded / loading → empty) on the pairs, events, api-keys, and webhooks pages are wrapped in aria-live="polite" regions so screen-reader users are notified when content arrives. Error messages continue to use role="alert" for assertive announcements. A single polite region per page prevents double announcements.
On every push/PR to main, GitHub Actions runs:
npm cinpm run buildnpm test
Ensure these pass locally before pushing.
- Fork the repo and create a branch from
main. - Add tests for new UI/behavior; keep
npm run buildandnpm testpassing. - Open a PR; CI must be green.
MIT