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 installation
npm install @tomtom-org/maps-sdk
# pnpm - enable auto-install-peers for easiest setup
echo "auto-install-peers=true" >> .npmrc
pnpm install @tomtom-org/maps-sdk

Peer dependencies (installed automatically with above commands):

  • lodash-es (v4) - Utility functions
  • turf (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', // Map labels language
baseUrl: 'https://api.tomtom.com', // API base URL
timeout: 10000, // Request timeout (ms)
validateRequest: true // Enable request validation
});

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.