Stack

← Back


Core Dependencies

PackageRole
maplibre-glWebGL map renderer (peer dependency)
reactComponent framework (peer dependency)
react-domcreateRoot for Popup React content
typescriptType safety
vite + vite-plugin-dtsLibrary mode build + type declarations

Peer dependencies must be installed in the consumer project, not inside TerrainX itself.


Map Data

OpenFreeMap (tiles.openfreemap.org)

  • Free, no API key
  • OpenStreetMap data, OpenMapTiles schema
  • Vector tiles (.pbf) — fetched by MapLibre automatically

Nominatim (nominatim.openstreetmap.org)

  • Free geocoding, no key needed
  • Used only by <SearchBox />
  • Requests are debounced at 400ms + AbortController for cleanup

Build

Vite in library mode — outputs:

FileFormatUse case
dist/index.es.jsESMVite / webpack projects
dist/index.umd.jsUMDCDN / non-bundler
dist/index.d.tsTypeScriptType checking
dist/style.cssCSSMapLibre base styles
npm run build

Install in another project

npm install ../TerrainX        # local path
// Once in your app entry file
import 'terrainx/dist/style.css'
 
// Then anywhere
import { Map, Marker, Popup } from 'terrainx'

What’s NOT included

  • No backend or server
  • No tile server (uses OpenFreeMap)
  • No authentication anywhere
  • No state persistence