SDK Installation
Complete installation guide for De. SDKs across all platforms and frameworks.
Quick Installation
Web (npm):
npm install @de./sdkReact Native:
npm install @de./sdk-rn
cd ios && pod installWeb SDK Installation
Package Managers
Install via NPM
Recommended for most projects
npm install @de./sdkVerify installation:
npm list @de./sdkInstall via Yarn
For Yarn users
yarn add @de./sdkVerify installation:
yarn why @de./sdkInstall via PNPM
For PNPM users
pnpm add @de./sdkVerify installation:
pnpm list @de./sdkCDN Installation
For quick prototypes or non-bundled projects:
<!DOCTYPE html>
<html>
<head>
<title>De. SDK Demo</title>
</head>
<body>
<div id="map" style="width: 100%; height: 600px;"></div>
<!-- De. SDK -->
<script src="https://cdn.dedot.io/sdk/1.0.0/de.sdk.js"></script>
<script>
// SDK is available as global De
const msi = new De.MSI({
element: 'map',
accessToken: 'your-token'
})
msi.load().then(({ controls }) => {
console.log('Map loaded!')
})
</script>
</body>
</html>CDN Versions:
- Latest:
https://cdn.dedot.io/sdk/latest/de.sdk.js - Specific:
https://cdn.dedot.io/sdk/1.0.0/de.sdk.js - Minified:
https://cdn.dedot.io/sdk/1.0.0/de.sdk.min.js
Framework-Specific Installation
React
Install Dependencies
Add SDK and types
npm install @de./sdk
npm install --save-dev @types/nodeEnvironment Variables
Create .env file
# .env.local
REACT_APP_DE_WORKSPACE_ID=your-workspace-id
REACT_APP_DE_ACCESS_TOKEN=your-access-tokenCreate Map Component
src/components/Map.tsx
import { useEffect, useRef } from 'react'
import De from '@de./sdk'
export default function Map() {
const mapRef = useRef<HTMLDivElement>(null)
const msiRef = useRef<any>(null)
useEffect(() => {
if (!mapRef.current) return
const initMap = async () => {
msiRef.current = new De.MSI({
element: mapRef.current!,
accessToken: process.env.REACT_APP_DE_ACCESS_TOKEN
})
await msiRef.current.load()
}
initMap()
return () => {
msiRef.current?.destroy()
}
}, [])
return (
<div
ref={mapRef}
style={{ width: '100%', height: '600px' }}
/>
)
}Next.js
Install Package
Add SDK
npm install @de./sdkEnvironment Variables
.env.local
NEXT_PUBLIC_DE_WORKSPACE_ID=your-workspace-id
NEXT_PUBLIC_DE_ACCESS_TOKEN=your-access-tokenCreate Client Component
app/components/Map.tsx
'use client'
import { useEffect, useRef } from 'react'
import De from '@de./sdk'
export default function Map() {
const mapRef = useRef<HTMLDivElement>(null)
useEffect(() => {
if (!mapRef.current) return
const msi = new De.MSI({
element: mapRef.current,
accessToken: process.env.NEXT_PUBLIC_DE_ACCESS_TOKEN
})
msi.load()
return () => msi.destroy()
}, [])
return <div ref={mapRef} style={{ width: '100%', height: '600px' }} />
}Use in Page
app/page.tsx
import dynamic from 'next/dynamic'
// Disable SSR for map component
const Map = dynamic(() => import('./components/Map'), {
ssr: false,
loading: () => <div>Loading map...</div>
})
export default function Home() {
return (
<main>
<h1>Delivery Tracking</h1>
<Map />
</main>
)
}Vue 3
Install Package
Add SDK
npm install @de./sdkEnvironment Variables
.env
VITE_DE_WORKSPACE_ID=your-workspace-id
VITE_DE_ACCESS_TOKEN=your-access-tokenCreate Map Component
src/components/Map.vue
<template>
<div ref="mapContainer" style="width: 100%; height: 600px"></div>
</template>
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue'
import De from '@de./sdk'
const mapContainer = ref<HTMLDivElement | null>(null)
let msi: any = null
onMounted(async () => {
if (!mapContainer.value) return
msi = new De.MSI({
element: mapContainer.value,
accessToken: import.meta.env.VITE_DE_ACCESS_TOKEN
})
await msi.load()
})
onUnmounted(() => {
msi?.destroy()
})
</script>Angular
Install Package
Add SDK
npm install @de./sdkEnvironment Variables
src/environments/environment.ts
export const environment = {
production: false,
deWorkspaceId: 'your-workspace-id',
deAccessToken: 'your-access-token'
}Create Map Component
src/app/map/map.component.ts
import { Component, OnInit, OnDestroy, ViewChild, ElementRef } from '@angular/core'
import De from '@de./sdk'
import { environment } from '../../environments/environment'
@Component({
selector: 'app-map',
template: '<div #mapContainer style="width: 100%; height: 600px"></div>'
})
export class MapComponent implements OnInit, OnDestroy {
@ViewChild('mapContainer') mapContainer!: ElementRef
private msi: any
async ngOnInit() {
this.msi = new De.MSI({
element: this.mapContainer.nativeElement,
accessToken: environment.deAccessToken
})
await this.msi.load()
}
ngOnDestroy() {
this.msi?.destroy()
}
}Svelte
Install Package
Add SDK
npm install @de./sdkEnvironment Variables
.env
VITE_DE_WORKSPACE_ID=your-workspace-id
VITE_DE_ACCESS_TOKEN=your-access-tokenCreate Map Component
src/components/Map.svelte
<script lang="ts">
import { onMount, onDestroy } from 'svelte'
import De from '@de./sdk'
import { env } from '$env/dynamic/public'
let mapContainer: HTMLDivElement
let msi: any
onMount(async () => {
msi = new De.MSI({
element: mapContainer,
accessToken: env.VITE_DE_ACCESS_TOKEN
})
await msi.load()
})
onDestroy(() => {
msi?.destroy()
})
</script>
<div bind:this={mapContainer} style="width: 100%; height: 600px"></div>React Native SDK Installation
Prerequisites
- Node.js 16+
- React Native 0.68+
- iOS: Xcode 13+, CocoaPods
- Android: Android Studio, JDK 11+
Installation Steps
Install Package
Add React Native SDK
npm install @de./sdk-rnInstall Pods (iOS)
Install native dependencies
cd ios
pod install
cd ..Configure iOS
ios/Podfile
platform :ios, '13.0'
target 'YourApp' do
# ... existing config
# De. SDK
pod 'DeSdk', :path => '../node_modules/@de./sdk-rn'
endConfigure Android
android/app/build.gradle
android {
compileSdkVersion 33
defaultConfig {
minSdkVersion 23
targetSdkVersion 33
}
}
dependencies {
// De. SDK auto-linked
implementation project(':de-sdk-rn')
}Permissions (iOS)
ios/YourApp/Info.plist
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need your location to show delivery tracking</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We need your location for background tracking</string>Permissions (Android)
android/app/src/main/AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />TypeScript Configuration
Web Projects
tsconfig.json:
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": true,
"strict": true,
"skipLibCheck": true,
"types": ["@de./sdk", "node"]
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}React Native Projects
tsconfig.json:
{
"extends": "@react-native/typescript-config/tsconfig.json",
"compilerOptions": {
"types": ["@de./sdk-rn", "react-native"]
}
}Environment Setup
Development Environment
Create .env file:
# Development
DE_WORKSPACE_ID=ws_dev_123
DE_ACCESS_TOKEN=sk_dev_xyz789
DE_ENVIRONMENT=dev
DE_API_URL=https://dev-api.dedot.ioStaging Environment
.env.staging:
# Staging
DE_WORKSPACE_ID=ws_staging_123
DE_ACCESS_TOKEN=sk_staging_xyz789
DE_ENVIRONMENT=staging
DE_API_URL=https://staging-api.dedot.ioProduction Environment
.env.production:
# Production
DE_WORKSPACE_ID=ws_prod_123
DE_ACCESS_TOKEN=sk_prod_xyz789
DE_ENVIRONMENT=prod
DE_API_URL=https://api.dedot.ioLoad Environment Variables
JavaScript/TypeScript:
import dotenv from 'dotenv'
dotenv.config()
const config = {
workspace: process.env.DE_WORKSPACE_ID,
accessToken: process.env.DE_ACCESS_TOKEN,
env: process.env.DE_ENVIRONMENT
}React Native:
npm install react-native-dotenvimport { DE_WORKSPACE_ID, DE_ACCESS_TOKEN } from '@env'
const config = {
workspace: DE_WORKSPACE_ID,
accessToken: DE_ACCESS_TOKEN
}Verification
Test Installation
Create a test file to verify SDK is working:
test-sdk.js:
import De from '@de./sdk'
console.log('De. SDK version:', De.version)
const access = new De.Access({
workspace: 'test',
accessToken: 'test'
})
console.log('SDK loaded successfully!')Run test:
node test-sdk.jsExpected output:
De. SDK version: 1.0.0
SDK loaded successfully!Troubleshooting
Common Issues
Module Not Found
Error: Cannot find module '@de./sdk'
Solution:
# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm installTypeScript Errors
Error: Could not find declaration file
Solution:
# Install types
npm install --save-dev @types/node
# Add to tsconfig.json
{
"compilerOptions": {
"types": ["@de./sdk"]
}
}Build Errors (React Native)
Error: Pod install failed
Solution:
cd ios
pod deintegrate
pod install
cd ..Access Token Invalid
Error: 401 Unauthorized
Solution:
- Check token is correct
- Verify workspace ID matches
- Regenerate token if expired
- Check environment variables loaded
Getting Help
If you encounter issues:
- Check the documentation
- Search GitHub issues
- Ask on Discord
- Contact [email protected]
Version Requirements
Minimum Versions
Web SDK:
- Node.js: 16.0.0+
- npm: 7.0.0+
- Browsers: Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
React Native SDK:
- Node.js: 16.0.0+
- React Native: 0.68.0+
- iOS: 13.0+
- Android: API 23+ (Android 6.0+)
Peer Dependencies
The SDK requires these peer dependencies:
{
"peerDependencies": {
"react": ">=17.0.0",
"react-dom": ">=17.0.0"
}
}Install if missing:
npm install react react-dom
