This repo is a Next.js application with ES modules in the app code and Node's built-in test runner for runtime tests.
npm install
npm run dev
npm run build
npm run start
npm run lint
npm testnpm run devruns the Express server inserver/App.jswith Next in development mode (hot reload). It also hosts the storage API, so saving works in dev.npm run buildbuilds the app.npm run startrunsserver/App.jsonPORTor3000.npm run lintruns ESLint.npm testrunsnode --experimental-default-type=module --test tests/*.test.js.
Test files are grouped by area: visual-script-runtime.test.js, editor-core.test.js, editor-map-mode.test.js, earth-import-mode.test.js, bake-*.test.js, and storage-service.test.js.
Environment edits, scripts, and bindings are persisted on the server rather than in the browser. The backend is deliberately simple - no database, just JSON files with an in-memory cache:
server/storage/JsonFileStore.js- one file's worth of JSON: reads are cached in memory, writes are atomic (temp file + rename).server/storage/StorageService.js- owns the on-disk layout underserver/data/(environments/<id>.json,scripts/<id>.json,bindings.json,settings.json) and environment catalog operations.server/routes/storageRouter.js- the Express router mounted at/api/storage; a thin HTTP-to-service translation layer.app/client/storageClient.js- the browser's single fetch wrapper for that API.app/3d/environment/EnvironmentCatalogClient.js- list/create/duplicate/rename/delete and active-environment settings.app/3d/environment/EnvironmentLoader.js- the sole manifest/template-to-runtime application path.app/3d/environment/EnvironmentPersistence.js- debounced manifest saving only.
The server/data/ directory is git-ignored; it is created on first write.
app/page.js: browser entry and mode switch.app/3d/: Three.js scene, vehicles, devices, city objects, overlays, and IGVC scenarios.app/3d/editor/: environment editor state, tools, chunks, and document model.app/3d/earth/: Earth Import (tiles, roads, geospatial transforms).app/client/: orchestrator WebSocket and message encoding client.app/physics/: physics engine wrapper.app/scripting/: visual node editor, block classes, runtime compiler, and runner.app/simulation/: simulation loop.app/util/: shared utilities.public/: static assets served by Next.tests/: Node tests.
The app uses @/ imports for repo-root app paths in many modules. Keep new imports consistent with the surrounding file.
Run the focused check for the area you touched:
npm test
npm run lintFor visual or simulation changes, also run npm run dev and manually verify:
- The scripting canvas still loads.
- The
Escapemenu switches between scripting, simulation, and the environment editor. - The 3D scene starts without console errors.
- If orchestrator integration changed, the app behaves both with and without the orchestrator running.
For environment editor or earth import changes, also verify:
- Scene, map, and earth-import modes enter and exit cleanly.
- Earth Import preview and apply work with a valid
NEXT_PUBLIC_GOOGLE_MAPS_API_KEYin.env.local. npm testpasses fortests/editor-*.test.jsandtests/earth-import-mode.test.js.
- Keep visual scripting block UI and backend
UnitBlockbehavior in sync. - Register compileable blocks in both the block registry path and
UnitCatalog.js. - Keep message definitions in
public/messages/synchronized with the orchestrator repo when they are used as browser fallbacks - this will be edited soon to be synchronized. - Do not commit downloaded CommonRoad scenario folders or other large generated assets.
| Variable | Required for | Notes |
|---|---|---|
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY |
Earth Import tile preview | Map Tiles API (Photorealistic 3D Tiles). Set in .env.local, not committed. |
See Earth Import for setup and troubleshooting.