starfleet-ui
A web UI for Starfleet — the space trading game you play over HTTP.
Log in with your captain's API key (sfk_…) and fly the galaxy from your browser:
- Map-first HUD: a live 3D galaxy and system map fills the screen, with panels on top. Select a ship, click a destination, preview the trip (time, fuel, route over jump lanes), and go.
- Ship console: the API decides which actions are legal (HATEOAS); the UI gives them clear labels, hotkeys, input limits (cargo, credits, supply), cost estimates and dry-run previews, and explains why the rest are greyed out.
- Guidance: per-ship hints ("fuel low — refuel here", "your iron is wanted at BB-2-B", "scan the derelict") and a trade helper that ranks cargo runs between known markets by profit per minute.
- Live: the fleet rail, ETAs and captain's log update over SSE.
- Contracts, postings, federation, factions, messages, codex: drawers over the map.
See docs/architecture.md for the structure, the assumptions the estimates rely on, and the 3D gotchas.
Stack
Bun · SvelteKit (SSR, server loads, cookie auth) · Svelte 5 runes · Tailwind CSS 4 · Threlte/Three.js · @sveltejs/adapter-bun
The game API sends no CORS headers, so all browser traffic goes through a same-origin
proxy (/api/[...path]) that attaches your key from an httpOnly cookie. Server-side
loads call the API directly.
Run it
bun install
bun run dev # http://localhost:5173
bun run test # unit tests (game logic)
bun run check # type check
Production:
bun run build
bun run build/index.js # or: bun ./build
Point at a local game server with STARFLEET_API_URL=http://127.0.0.1:8080.