This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
@maptool/core — an npm library of reusable React components, hooks, and utilities for building geospatial map applications with deck.gl, MapLibre GL JS, and TiTiler.
npm run build # Vite library build + TypeScript declaration emit
npm run test # Vitest (unit tests, jsdom)
npm run test:watch # Vitest in watch mode
npm run test:e2e # Playwright end-to-end tests
npm run lint # TypeScript type-check (tsc --noEmit)
npm run dev # Vite dev serverRun a single test file: npx vitest run src/utils/titiler.test.ts
All test apps have server.host: true baked into their vite.config.ts, so they always bind to 0.0.0.0 for remote port forwarding.
npm run serve -- no2-viewer # Build library + serve one app
npm run serve -- no2-viewer fire-tracker # Serve multiple apps
npm run serve:all # Serve all 11 appsStable port assignments (alphabetical):
| Port | App |
|---|---|
| 5174 | air-quality-dashboard |
| 5175 | building-footprints |
| 5176 | fire-tracker |
| 5177 | forest-change-viewer |
| 5178 | land-cover-explorer |
| 5179 | no2-viewer |
| 5180 | precipitation-viewer |
| 5181 | sea-surface-temp |
| 5182 | wind-globe |
| 5183 | earthquake-arcs |
| 5184 | coastal-explorer |
- The
servescript builds@maptool/corefirst (test apps import fromdist/) - Report URLs as
http://localhost:<port>/for the user to open - Keep processes running unless the user asks to stop them
This is a library (not an app). It builds to dist/ as ES + CJS modules via Vite's library mode. React, deck.gl, MapLibre, and Chakra UI are peer dependencies (externalized from the bundle).
components/— React UI components (MapLegend,AnimationTimeline,MapToolProviderwhich wraps Chakra'sChakraProvider)hooks/— React hooks (useTitiler,useSTAC,useAnimationClock,useColorScale,useTimeRange)layers/— deck.gl layer factory functions (createCOGLayer,createSTACLayer)utils/— Pure utility functions for TiTiler API calls, STAC catalog operations, colormaps, and number formattingindex.ts— Public API barrel export (all components, hooks, layers, utils, and types)
- TiTiler:
useTitilerhook andsrc/utils/titiler.tshandle COG metadata fetching and tile URL construction against a TiTiler raster tile server - STAC:
useSTAChook andsrc/utils/stac.tshandle SpatioTemporal Asset Catalog search and item management - Colormaps:
src/utils/colormaps.tscontains built-in colormap definitions used byuseColorScale
Tests live alongside source files as *.test.{ts,tsx}. Uses Vitest with jsdom environment. Test utilities in src/test-utils.tsx.