§ architecture

One engine. Twelve subpaths.

A single npm package with tree-shakeable subpath exports. Every subpath depends down the stack, never sideways. WebGPU at the bottom, widgets on top, adapters and analysis plugged in wherever they make sense.
modules12
classes67+
ts · strictzero any
packaging1 npm · 12 subpaths · tree-shake
layers · bottom → top

The stack

Each layer only sees the ones beneath it. Swap a render backend, swap a WASM core — everything above keeps compiling.
L7application
Your apps · site frameworks · user product. Compose MapView · add layers · bind widgets.
user appslandingdemo
any framework
L6bindings
Typed components + hooks. <MapView>, useMap(), selection, popups.
mapgpu/react
React 18 / 19
L5widgets
11 widgets. LayerList, Legend, Popup, ScaleBar, Coordinates, Search, BasemapGallery, Measurement, TimeSlider, LOS, DockPanel.
mapgpu/widgets
dom overlay · canvas 2d
L4domain
The gsp/geo feature set. 7 subpaths: feature contract, protocol adapters, 3D tiles, terrain, analysis, tools, mil-std symbols.
mapgpu/layersmapgpu/adaptersmapgpu/analysismapgpu/toolsmapgpu/tiles3dmapgpu/terrainmapgpu/milsymbol
feature contract · protocol adapters · 3D tiles
L3core
MapView + ViewCore (RenderEngine, TileManager, LayerManager, BufferCache). Mode2D/Mode3D strategy, UnitManager, EventBus, interfaces ILayer / IRenderEngine / IRenderer / IViewMode.
mapgpu/core
TS strict · typed events
L2render
RenderEngine facade + 12 draw delegates. raster · globe · cluster · mesh3d · model · extrusion · particle · picking · custom · vector · shared · gltf2. Pipelines dir + BufferPool + TextureManager + BindGroupCache.
mapgpu/render
WebGPU · WGSL · compute + render
L1gpu / browser
WebGPU swapchain + WGSL shaders. Browser runtime — canvas context, premultiplied alpha.
WebGPUWGSL
canvas context · premultiplied alpha
L0native
Rust + wasm-bindgen. 12 modules: mvt_parse, triangulation (earcut), clustering, projection, terrain_mesh, hillshade, spatial_index, geojson_parse, line_tessellation, binary_codec, rtc, lib.rs.
mapgpu/wasm
Rust · wasm-pack · off-thread

Why this shape

One npm package, 12 subpath exports — tree-shake per feature. Strict interface boundaries (ILayer, IRenderEngine, IRenderer, IViewMode) keep layers decoupled.

WASM core lives outside the browser's JS main thread path (worker hookable) — no GC pressure on the hot render loop. RenderEngine is a facade over draw delegates: any new pipeline plugs in behind one method.

01types first — no any in public API
02contracts over classes — swap implementers, not patch them
03GPU-native by default — state lives in buffers, not JS
04WASM for math — Rust owns projection, triangulation, MVT parse
class diagram · core composition

How MapView is wired

The runtime object graph for a single MapGPU instance. MapView delegates to ViewCore which owns the render engine and dispatches through IViewMode. Interfaces are solid; implementers branch off.
19 layers12 draw delegates4 core contracts12 wasm modules
MapViewpublic APImapgpu/coreEventBus<MapEvents>typed subscribemapgpu/coreemitsViewCoreRenderEngine · TileManagerLayerManager · BufferCachedelegatesRenderEnginefacade · WebGPUmapgpu/renderowns12 draw delegatesraster · vector · cluster · mesh3dmodel · extrusion · particle · pickingcustom · globe · shared · gltf2dispatches«interface» IViewMode2D / 3D strategyper-frame render«interface» ILayeronLoad · onRendervisibility · lifecycle«interface» IRenderersymbology contractfeature → symbolMode2DMode3DRasterVectorGeoJSONGraphicsSimpleCallbackClassBreaks · UniqueValuemapgpu/wasmearcut · mvt · projectionterrain · hillshade
Target budget · 60 fps

What happens every 16.6 ms

Per-frame budget envelope. Real cost scales with scene complexity; run the benchmark suite for concrete numbers.
01

Input

pointer · wheel · keyboard
event bus · view diff

0.1 ms
02

Project

mapgpu/wasm
lng/lat → clip-space

0.4 ms
03

Cull

frustum · tile pyramid
SSE traversal

0.8 ms
04

Encode

GPUCommandEncoder
one pass · draws

1.9 ms
05

Present

swapchain flip
picking buffer copy

3.2 ms
06

Emit

'render-frame' stats
widget sync

0.1 ms
dependency matrix · who imports who

No sideways imports.

Rows import columns. No row points back at a row above it — imports only flow toward the core.
↓ imports →corerenderlayersadaptersterraintiles3danalysistoolswidgetsreactmilsymbolwasm
core···········
render·········
layers·········
adapters··········
terrain········
tiles3d·········
analysis·········
tools·········
widgets··········
react··········
milsymbol···········
wasm···········