Skip to main content

Frontend Guide

The browser app is served as static HTML, CSS, and JavaScript. It has no bundler, and the Cesium and UI libraries are loaded by the page shells.

Where to make a change​

  • Earth page markup and controls: client/src/index.html.
  • Earth behavior: client/public/js/app.js; related layout and feature styling live in client/public/css/.
  • Shared Mars/Moon behavior: client/public/js/core/.
  • Data, layers, and entry points for one world: client/public/js/planets/<world>/.
  • Shared UI shell and feature wiring for Mars/Moon: client/src/<world>.html and that world's entry script.

Earth remains a large window.onload closure. Search by function name in app.js and by element ID from the page shell. Keep changes near the relevant feature, and check for an existing declaration before adding a function: duplicate function declarations are silently shadowed by the last declaration.

World boundaries​

core/ is planet-independent and must not contain planet-specific names or assumptions. A planets/<world>/ module may use core/ but must not reference another world's folder. Each world has its own page because Cesium's viewer ellipsoid is fixed when that viewer is created.

The Earth HTML shell is the reference for Mars/Moon shell IDs and classes. When changing shared shell behavior, update or inspect both client/src/index.html and client/public/js/core/ui/shell.js.

For a fuller directory map and the rules for adding a world or analysis tool, see client/public/js/README.md in the repository.

Check a frontend change​

Run node --check client/public/js/app.js after editing the Earth script. npm test always runs the notification, access, extension-loader, profile-dialog and OSM 3D Buildings checks and the server access and extension unit tests, and runs the planet-mode regression suite when optional jsdom is installed; that suite reports a skip otherwise. The frontend itself requires no build step.