Skip to content

Route Optimization MapUniversal Route Visualization Library

Build beautiful route optimization interfaces for React, Vue, and Vanilla JavaScript

Route Optimization Map

Quick Start ​

bash
npm install @route-optimization/react @route-optimization/core
bash
pnpm add @route-optimization/react @route-optimization/core
bash
yarn add @route-optimization/react @route-optimization/core

Example Usage ​

tsx
import { RouteMapView } from '@route-optimization/react';

function App() {
  const route = {
    id: 'route-1',
    vehicleId: 'vehicle-1',
    stops: [
      {
        id: 'start',
        location: { lat: 13.7563, lng: 100.5018 },
        type: 'START',
        sequence: 0,
      },
      {
        id: 'delivery',
        location: { lat: 13.7467, lng: 100.5342 },
        type: 'DELIVERY',
        sequence: 1,
      },
    ],
  };

  return <RouteMapView apiKey="YOUR_GOOGLE_MAPS_API_KEY" route={route} autoFitBounds />;
}
vue
<script setup>
import { RouteMapView } from '@route-optimization/vue';
import { ref } from 'vue';

const route = ref({
  id: 'route-1',
  vehicleId: 'vehicle-1',
  stops: [
    {
      id: 'start',
      location: { lat: 13.7563, lng: 100.5018 },
      type: 'START',
      sequence: 0,
    },
    {
      id: 'delivery',
      location: { lat: 13.7467, lng: 100.5342 },
      type: 'DELIVERY',
      sequence: 1,
    },
  ],
});
</script>

<template>
  <RouteMapView api-key="YOUR_GOOGLE_MAPS_API_KEY" :route="route" auto-fit-bounds />
</template>
javascript
import { RouteMap } from '@route-optimization/vanilla';

const routeMap = new RouteMap({
  apiKey: 'YOUR_GOOGLE_MAPS_API_KEY',
  container: 'map',
  center: { lat: 13.7563, lng: 100.5018 },
  zoom: 12,
});

await routeMap.initialize();

const route = {
  id: 'route-1',
  vehicleId: 'vehicle-1',
  stops: [
    {
      id: 'start',
      location: { lat: 13.7563, lng: 100.5018 },
      type: 'START',
      sequence: 0,
    },
    {
      id: 'delivery',
      location: { lat: 13.7467, lng: 100.5342 },
      type: 'DELIVERY',
      sequence: 1,
    },
  ],
};

routeMap.renderRoute(route);

Packages ​

PackageVersionBundle SizeDescription
@route-optimization/core0.1.0~13KBCore types and adapters
@route-optimization/react0.1.0~11KBReact hooks and components
@route-optimization/vue0.1.0~7KBVue 3 composables
@route-optimization/vanilla0.1.0~6KBVanilla JavaScript wrapper
@route-optimization/converter0.1.0~8KBDirectionsResult converter

Why Route Optimization Map? ​

  • Framework Agnostic - Works with React, Vue, Vanilla JS, or any framework
  • Production Ready - 160+ tests, 95% code coverage, TypeScript strict mode
  • Developer Friendly - Comprehensive documentation, examples, and TypeScript support
  • Lightweight - Small bundle sizes with tree-shaking support
  • Extensible - Easy to customize and extend for your specific needs

License ​

MIT Β© 2025 ks-arm

Released under the MIT License.