Core quickstart
The Core bundle (@tomtom-org/maps-sdk/core) holds what the Map and Services bundles share: the global configuration, the place and route types, and utilities for coordinates, bounding boxes, formatting and routes.
Installing dependencies
Core is part of the SDK package, so installing the SDK installs it:
npm install @tomtom-org/maps-sdk
Core needs lodash-es and @turf/turf as peer dependencies. The project setup guide lists them for every bundle and explains how pnpm installs them.
Common configuration
Set the API key once at startup. Every map and service call reads it:
import { TomTomConfig } from '@tomtom-org/maps-sdk/core';
TomTomConfig.instance.put({
apiKey: 'YOUR_API_KEY',
language: 'en-GB'
});
Before you ship, decide where this key will live. A key used from the browser can be read by anyone who opens the page. A key used from Node.js cannot. See Where your API key runs for which case you are in and what to do about it, and TomTom's API key management best practices for key restrictions, rotation and monitoring.
The global configuration guide covers every option, how a map or a single call overrides it, and the Node.js setup.
Using with map bundle
import { TomTomConfig } from '@tomtom-org/maps-sdk/core';
import { TomTomMap } from '@tomtom-org/maps-sdk/map';
TomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY' });
const map = new TomTomMap({ mapLibre: { container: 'map' } });
Next: the map quickstart.
Using with services bundle
import { TomTomConfig } from '@tomtom-org/maps-sdk/core';
import { discoverPlaces } from '@tomtom-org/maps-sdk/services';
TomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY' });
const results = await discoverPlaces({
query: 'restaurants',
geoBias: { position: [4.9041, 52.3676] }
});
Next: the services quickstart.