How project-osrm/osrm-frontend works
osrm-frontend is a browser-based route-planning map built on Leaflet Routing Machine. Users choose locations, optionally select OSM entrances and routing preferences, request directions from an OSRM backend, then inspect and share the route. The graph also preserves the documented map-background and vector-rendering capabilities, plus route state, responsive presentation, and export tools. Several modules are indexed but not excerpted; their roles and links are included only where the README or source index supports them.
Main entry points: index.js App bootstrap · state.js Route and view state · tools.js Map tools · entrance_waypoints.js Entrance waypoints
Components 28
App orchestration
- App bootstrap
src/index.js
Route planning
- Waypoint placement
src/waypoint_placement.js - Place search
src/geocoder.js - Entrance picker
src/entrance_picker.js - Entrance waypoints
src/entrance_waypoints.js - Itinerary builder
src/itinerary_builder.js - Stop ordering
src/waypoint_reorder.js - Route preferences
src/route_preferences.js - Router adaptation
src/router_patches.js - Route and directions
src/route_properties.js
Map and layers
- Route framing
src/route_zoom.js - Map configuration
src/leaflet_options.js - Background selection
src/layers_control.js - Vector backgrounds
src/vector_backgrounds.js - Vector rendering
src/vector_renderer.js - Vector runtime
src/vector_runtime.js
Interface and state
- Route and view state
src/state.js - URL state
src/url_state.js - Directions interface
src/interface_theme.js - Responsive viewport
src/mobile_viewport.js - Localization
src/localization.js
Services and sharing
- OSRM backend
- Map tile services
- Map tools
src/tools.js - GPX export
src/gpx.js - Short links
src/shortlink.js - Browser storage
Other components
- Map user
Connections 29
- Map user → App bootstrap: uses
- App bootstrap → Place search: creates
src/index.js - App bootstrap → Waypoint placement: configures
src/index.js - App bootstrap → Entrance waypoints: refreshes
src/index.js - Entrance waypoints → Entrance picker: uses
src/entrance_waypoints.js - App bootstrap → Itinerary builder: initializes
src/index.js - App bootstrap → Route preferences: applies
src/index.js - App bootstrap → Router adaptation: patches
src/index.js - Router adaptation → OSRM backend: requests routes
- App bootstrap → Route and directions: configures
- App bootstrap → Route framing: uses
src/index.js - App bootstrap → Map configuration: configures
src/index.js - Map configuration → Vector backgrounds: creates
src/leaflet_options.js - Vector backgrounds → Vector rendering: renders with
- Vector rendering → Vector runtime: uses
- Vector runtime → Map tile services: loads tiles
- App bootstrap → Background selection: creates
src/index.js - App bootstrap → Route and view state: updates
src/index.js - Route and view state → Itinerary builder: reads
src/state.js - Route and view state → Stop ordering: uses
src/state.js - Route and view state → URL state: uses
src/state.js - Route and view state → Browser storage: persists
- App bootstrap → Directions interface: initializes
src/index.js - Directions interface → Responsive viewport: uses
src/interface_theme.js - App bootstrap → Localization: configures
src/index.js - App bootstrap → Map tools: creates
src/index.js - Map tools → GPX export: exports
src/tools.js - Map tools → Short links: creates
src/tools.js - App bootstrap → Browser storage: reads settings