Inspiration
API failures cost real money — but dashboards only show up/down. We wanted a fleet that catches drift before it becomes downtime, using the same math that prices prediction markets.
What it does
API Sentinel Fleet polls N endpoints every 8s, scores each with a 3-model ensemble (latency-z vs rolling median, momentum tilt, staleness detector HEALTHY → WARN → FAILOVER), and auto-failovers when edge crosses the band. Generalized from predictrader-ai: loadMarkets() → loadEndpoints(), fetchOrderBook() → fetchAPIHealth(), SpotHistory → LatencyHistory — same Φ k=√2/π, 120-sample ring.
Live: https://api-sentinel-fleet.vercel.app · GitHub: https://github.com/binasalama12/api-sentinel-fleet
How we built it
- Stack: Next.js 14, TypeScript, Node fetch,
viempatterns, Docker (Cloud Runnode:20-slim, non-root,$PORT), OpenAPI 3.1 (5 routes,X-Fleet-Key) - Infra: Vercel + Cloud Run, horizontal fleet scaling — one fleet hits API + Cloud + AI tracks at once
- Demo-safe:
DEMO_FALLBACKkeeps the dashboard live even when endpoints are idle
Challenges we ran into
Generalizing trading math to latency without losing the ensemble signal — z-score calibration and the 35% muzzle needed retuning. Also wiring openapi.yaml X-Fleet-Key to handlers (declared but not yet enforced — noted in repo).
Accomplishments that we're proud of
- One fleet, 8 sponsor tracks (Overall $12.5k + SerpApi + Perfect Corp + Xano + name.com + Nutrient + Foxit + Doctavian) — max EV from single build
- 5 sentinels shipped from 1 base (
predictrader-ai→ fleet/bio/rice/ethonline), all live200on Vercel - Clean OpenAPI + Dockerfile for sponsor brownie points
What we learned
Trading infra is API infra — same polling, same ensemble, new domain. Sponsor-track thinking beats single-track: one good fleet > three thin projects.
What's next for API Sentinel Fleet
Wire X-Fleet-Key enforcement, add PagerDuty/Slack webhooks on FAILOVER, and scale fleet controller to N regions. PRs open at binasalama12/api-sentinel-fleet.
Built With
- cloud-run
- docker
- next.js
- node.js
- openapi-3.1
- tailwind
- typescript
- vercel
Log in or sign up for Devpost to join the conversation.