1
0

The sky gets the things above the aeroplanes

Satellites, end to end: CelesTrak element sets behind the same TTL cache
the weather and the flights use, served as TLEs rather than as positions,
and propagated in the browser with SGP4.

Sending elements is the same trick `flights/plan.ts` plays and it has a
better excuse here — a TLE *is* the closed form, valid for days either
side of its epoch, so one cacheable fetch every six hours replaces a poll
and every viewer agrees about where everything is.

Two things are worth knowing about the shape of it:

  - There is no region parameter. An aeroplane at 10,000 m is local and
    a satellite at 550 km is above the horizon for a circle two thousand
    kilometres across, so one catalogue serves both boards and the client
    decides what is above its own horizon. Only the observer is per-city,
    which is why `main.ts` shares the elements and rebuilds the catalogue.
  - The layer draws on a dome, because it cannot draw anywhere else.
    `world.metres(550_000)` is 21,000 scene units against a far plane at
    3,000. Azimuth and elevation are real; the radius carries nothing.

Off by default: a clone that started pulling CelesTrak on `npm run dev`
would have volunteered somebody else's bandwidth for its onboarding.

Godmode gets the two dials that point at the sky rather than at the
light — fabricated traffic, which composes with a live ADS-B feed instead
of replacing it, and a switch for the satellite layer with a count beside
it. Both are god-only lies about the inputs, in the manner of the weather
override.

`satellite.js` is the second runtime dependency this package has taken.
Its entry point star-exports an Emscripten build that cannot be shaken
out, so `noWasmPropagator` in the Vite config cuts it: 308 kB of WASM
loader for a bulk propagator nothing calls, against 26 kB for the SGP4
that does the work.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-06 20:57:14 -07:00
parent 0cc2126e85
commit a229fb2721
23 changed files with 2062 additions and 12 deletions
+1
View File
@@ -48,6 +48,7 @@ export function registerHealth(app: FastifyInstance, services: Services): void {
sources: {
weather: config.weather.source,
flights: config.flights.source,
satellites: config.satellites.source,
markers: config.markers.source,
},
auth: {
+27
View File
@@ -0,0 +1,27 @@
/**
* `GET /api/v1/satellites` — the catalogue, for everybody, everywhere.
*
* The one route here that takes no query at all, and the absence is the design
* rather than an omission. `/flights` and `/weather` both resolve a region
* because their answers are local; a satellite catalogue is not. See the note at
* the top of `satellites/index.ts` for the reasoning, and note the consequence:
* with no parameter there is no key space, so none of the amplification concerns
* that shape `regions.ts` apply. There is exactly one body and it is the same one
* for every caller.
*
* Publicly cacheable, for a TTL measured in hours. Orbital elements for objects
* broadcasting their position to anyone with a radio are not personal data, and
* this body does not vary by who asked.
*/
import type { FastifyInstance } from "fastify";
import { publicCache } from "../cache.ts";
import type { Services } from "../services.ts";
export function registerSatellites(app: FastifyInstance, services: Services): void {
app.get("/api/v1/satellites", async (req, reply) => {
const body = await services.satellites.current();
publicCache(req, reply, body.ttlSeconds);
return body;
});
}