Based on the repository's commit message style and the changes in the diff, here's an appropriate commit message:

```
feat: add websocket tests, PoA metrics, marketplace endpoints, and enhanced observability

- Add comprehensive websocket tests for blocks and transactions streams including multi-subscriber and high-volume scenarios
- Extend PoA consensus with per-proposer block metrics and rotation tracking
- Add latest block interval gauge and RPC error spike alerting
- Enhance mock coordinator
This commit is contained in:
oib
2025-12-22 07:55:09 +01:00
parent fb60505cdf
commit d98b2c7772
70 changed files with 3472 additions and 246 deletions

View File

@ -1,15 +1,41 @@
# Marketplace Web
## Purpose & Scope
Mock UI for exploring marketplace offers and submitting bids.
Vite-powered vanilla TypeScript app for listing compute offers, placing bids, and showing market analytics. Follow the implementation blueprint in `docs/bootstrap/marketplace_web.md`.
## Development
## Development Setup
```bash
npm install
npm run dev
```
- Install dependencies with `npm install` once `package.json` is defined.
- Run the dev server via `npm run dev`.
- Build for production with `npm run build` and preview using `npm run preview`.
The dev server listens on `http://localhost:5173/` by default. Adjust via `--host`/`--port` flags in the `systemd` unit or `package.json` script.
## Notes
## Data Modes
Works against mock API responses initially; switch to real coordinator/pool-hub endpoints later via `VITE_API_BASE`.
Marketplace web reuses the explorer pattern of mock vs. live data:
- Set `VITE_MARKETPLACE_DATA_MODE=mock` (default) to consume JSON fixtures under `public/mock/`.
- Set `VITE_MARKETPLACE_DATA_MODE=live` and point `VITE_MARKETPLACE_API` to the coordinator backend when integration-ready.
### Feature Flags & Auth
- `VITE_MARKETPLACE_ENABLE_BIDS` (default `true`) gates whether the bid form submits to the backend. Set to `false` to keep the UI read-only during phased rollouts.
- `VITE_MARKETPLACE_REQUIRE_AUTH` (default `false`) enforces a bearer token session before live bid submissions. Tokens are stored in `localStorage` by `src/lib/auth.ts`; the API helpers automatically attach the `Authorization` header when a session is present.
- Session JSON is expected to include `token` (string) and `expiresAt` (epoch ms). Expired or malformed entries are cleared automatically.
Document any backend expectations (e.g., coordinator accepting bearer tokens) alongside the environment variables in deployment manifests.
## Structure
- `public/mock/offers.json` sample marketplace offers.
- `public/mock/stats.json` summary dashboard statistics.
- `src/lib/api.ts` data-mode-aware fetch helpers.
- `src/main.ts` renders dashboard, offers table, and bid form.
- `src/style.css` layout and visual styling.
## Submitting Bids
When in mock mode, bid submissions simulate latency and always succeed.
When in live mode, ensure the coordinator exposes `/v1/marketplace/offers`, `/v1/marketplace/stats`, and `/v1/marketplace/bids` endpoints compatible with the JSON shapes defined in `src/lib/api.ts`.