A Solar System viewer that runs in the browser, built with Vite, TypeScript and Three.js. Planet positions come from real orbital elements, not from a simulation, so any date between 1960 and 2165 gives the same answer every time.
- Eight textured planets, the Sun, and six moons (Moon, Io, Europa, Ganymede, Callisto, Titan).
- Elliptical orbits drawn from the orbital elements; Earth has a day-night shader with city lights and clouds.
- Focus and zoom on any body from the list, with the keyboard (1-8, S, +, -, 0) or by dragging and scrolling.
- Time controls: live 1:1 clock, pause, reverse, speeds from 1 min/s to 1000 d/s, a timeline for 1960-2165, a date field and bookmarked moments.
- Mission paths for Parker Solar Probe, JWST, Voyager 1, Cassini and Apollo 11, and guided tours.
- Works down to 400 px wide; a message is shown when WebGL is not available, and a reload prompt appears if the browser drops the WebGL context (the view resumes by itself if the context returns).
- Styled as an editorial star atlas: a serif plate for the focused body, dotted-leader figures, a text index of bodies and plain text controls. Text that sits over the 3D view has a dark scrim and halo so orbit lines and bright planets do not cut through it.
- The scene is drawn only when something changed (time running, camera moving, a control used); a paused, idle view costs no GPU frames. The pixel ratio is capped at 1.5 on screens 720 px wide or narrower and at 2 elsewhere.
- Keyboard: global shortcuts are ignored while the Credits dialog is open; the Time / View / Tours tabs on phones follow the tab pattern (arrow keys, Home, End,
aria-controls).
Positions use the approximate Keplerian elements and rates of Standish and Williams from JPL, solved with Newton iteration on Kepler's equation. Table 1 (valid 1800-2050) is used up to 2050 and Table 2a (valid over a longer span, lower accuracy) from 2050 to 2165; the switch moves positions by less than 0.2 degrees. Moons other than the Moon use circular orbits with arbitrary starting phases, and mission paths are simplified: each is a smooth curve through dated waypoints that are anchored to the app's own ephemeris (Voyager 1 is at Jupiter and Saturn on the flyby dates, Cassini at Venus, Earth, Jupiter and Saturn, Parker at Venus on its seven flybys, JWST on the Sun-Earth line beyond Earth, Apollo 11 at the Moon on the landing date). The curves between waypoints are interpolations, not trajectories, the JWST offset from Earth and the Earth-Moon distance are drawn enlarged, and Voyager 1's final direction is approximate. Sizes are enlarged and distances compressed in the default view; "True distances" switches to linear au.
Tests in tests/ check Earth at J2000, the 2024 perihelion, aphelion and equinox against reference values, the Kepler solver, the clock, the tours and the layout mapping.
cd web
npm ci
npm run dev # development server
npm test # vitest
npm run build # type check and static build into web/dist
npm run test:e2e # Playwright smoke tests (needs: npx playwright install chromium)
The e2e run starts vite preview on port 4179 (or reuses whatever already listens there); set PW_PORT to use another port, for example PW_PORT=4190 npm run test:e2e.
web/dist is a static site: base is ./, so every URL in the built page (script, stylesheet, fonts, textures, favicon) is relative. It works at the root of a subdomain or in any directory, needs no rewrite rules (there is one index.html and no client-side routes) and no server code.
It also runs under a strict Content-Security-Policy. This policy was checked against the built site served from /, with the Earth, View-tab, Credits and tour paths exercised and no violation reported:
default-src 'self'; style-src 'self'; font-src 'self'; img-src 'self'
There is no inline script, no inline <style> and no style="" attribute in the HTML; all styling set from script goes through the CSSOM, which style-src 'self' allows. Textures are loaded from textures/ as images from the same origin.
Planet textures are from Solar System Scope (https://www.solarsystemscope.com/textures/), CC BY 4.0, unmodified 2k maps copied from assets/planets/. The Sun and moon surfaces are generated procedurally. Orbital elements are from the JPL Solar System Dynamics group. See 3rdparty_licenses.md in the repository root.