Skip to content

Migrate legacy api/*.js data endpoints to sebuf RPC pattern #1311

@koala73

Description

@koala73

Summary

Several data-serving API endpoints use the legacy flat api/*.js pattern instead of the structured sebuf protobuf RPC pattern (api/{domain}/v1/[rpc].ts). These should be migrated for consistency, type safety, and maintainability.

Endpoints to migrate

Legacy endpoint Target sebuf domain Notes
api/satellites.js intelligence/v1/list-satellites New endpoint, should have been sebuf from the start
api/military-flights.js military/v1/list-military-flights Sebuf RPC exists but uses live upstream fetch instead of reading seeded Redis data
api/reverse-geocode.js geo/v1/reverse-geocode Utility, could be sebuf
api/gpsjam.js intelligence/v1/get-gpsjam Data endpoint, should follow sebuf pattern
api/oref-alerts.js conflict/v1/list-oref-alerts Data endpoint with WebSocket complexity
api/telegram-feed.js intelligence/v1/list-telegram-feed Data endpoint
api/polymarket.js Already covered by prediction/v1/list-prediction-markets May just need frontend migration

Endpoints that are fine as legacy

These are ops/utility endpoints that don't serve domain data:

  • bootstrap.js — aggregator
  • health.js, seed-health.js — ops
  • register-interest.js — Convex mutation
  • version.js, download.js, cache-purge.js — utility
  • og-story.js, story.js — SSR/OG meta
  • fwdstart.js — redirect
  • rss-proxy.js — generic proxy
  • opensky.js — raw proxy for desktop path
  • ais-snapshot.js — AIS data proxy
  • geo.js — utility

Additional context

  • A test guardrail (tests/no-new-legacy-endpoints.test.mjs) has been added to prevent new legacy endpoints from being created without explicit approval
  • The sebuf workflow: define messages in proto/buf generate → implement handler in server/worldmonitor/{domain}/v1/ → wire in handler.ts
  • Each migration should update the frontend caller to use the generated sebuf client instead of raw fetch()

Acceptance criteria

  • Each migrated endpoint has a proto definition, generated types, and handler
  • Frontend callers updated to use sebuf client
  • Legacy endpoint removed or redirected
  • Health endpoint updated if Redis key names change

Metadata

Metadata

Labels

High ValueMeaningful contribution to the projectchoreMaintenance, linting, tooling

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions