Core quickstart
The Core bundle provides essential shared functionality across the entire Maps SDK, including configuration management, common types, and utility functions.
Installing Dependencies
The Core bundle is automatically included when you install the Map or Services bundles:
# npm or Yarn - automatic peer dependency installationnpm install @tomtom-org/maps-sdk
# pnpm - enable auto-install-peers for easiest setupecho "auto-install-peers=true" >> .npmrcpnpm install @tomtom-org/maps-sdkPeer dependencies (installed automatically with above commands):
lodash-es(v4) - Utility functionsturf(v7) - Geospatial analysis
For more details, see the Project setup guide.
Common Configuration
import { TomTomConfig } from '@tomtom-org/maps-sdk/core';
TomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY_HERE', language: 'en-GB'});TomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY_HERE', language: 'en-GB', // Search/routing/map labels language commonBaseURL: 'https://api.tomtom.com', // API base URL apiVersion: 1 // Default API version for services});For a full reference of every global option — including display units and retry behavior — and how global values combine with per-request options, see the Global configuration guide.
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_HERE'});
const map = new TomTomMap({ mapLibre: { container: 'map' } });Using with Services Bundle
import { TomTomConfig } from '@tomtom-org/maps-sdk/core';import { search } from '@tomtom-org/maps-sdk/services';
TomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY_HERE'});
const results = await search({ query: 'restaurants', position: [4.9041, 52.3676]});Node.js Configuration
const { TomTomConfig } = require('@tomtom-org/maps-sdk/core');
TomTomConfig.instance.put({ apiKey: process.env.TOMTOM_API_KEY, language: 'en-GB'});The Core bundle is automatically included when you install the Map or Services bundles - no separate installation needed.