RideKit
Docs/Reference/Maps, address search and routing

Maps, address search and routing

Built: 2026-11-26. This is for operators choosing a map provider, and for whoever maintains the code.

RideKit does three map jobs on the server and one in the apps:

Job Where Engines
Address search (geocoding, reverse geocoding) backend /geo/search, /geo/reverse Google, Mapbox or OSM (Nominatim)
Routes (distance, ETA, the line on the map, turn-by-turn steps) backend /geo/route Google, Mapbox or OSM (OSRM)
The console's map admin, Leaflet OpenStreetMap tiles, or any tile URL (Mapbox, MapTiler, your own)
The apps' map rider, driver, partner apps Google Maps SDK on Android, Apple Maps on iOS

Address search and routes are chosen separately. You can search addresses on Mapbox and route on your own OSRM server, or keep Google for search and route on OSM. No paid provider is required: with no keys at all, everything runs on OpenStreetMap.

Choosing the engines (Admin → Providers)

Group Field Meaning
Google Maps API Key Places API (New), Geocoding API and Routes API
Mapbox Access token A public token (pk.…) with the default scopes
Maps: search and routes Address search engine google, mapbox or osm
Routing engine google, mapbox or osm
Nominatim server Your own Nominatim, e.g. https://nominatim.example.com. Blank: the public server
OSRM server Your own OSRM, e.g. https://osrm.example.com. Blank: the public demo server

Rules (backend/src/geo/providers/geo-engines.ts):

  • An engine is used only when its key is present. osm needs no key.
  • A blank choice takes the best engine you have a key for: Google, then Mapbox, then OSM.
  • Choosing google or mapbox without its key falls back the same way, so a missing key never breaks search; the map just uses the next engine.
  • A key that the provider refuses also falls back. A Google key without the Routes API (403) or the Geocoding API (REQUEST_DENIED), or Mapbox out of quota: OSRM draws the route, Nominatim names the pin and searches the address. The backend log names the API to enable, for example "google route failed, answered by OSRM … (enable the Routes API for this key in Google Cloud)". A straight line or bare coordinates show only when OpenStreetMap cannot answer either.
  • Changes take effect within a minute; no restart.

Every field also has an environment fallback, used when the admin field is blank: GOOGLE_MAPS_API_KEY, MAPBOX_ACCESS_TOKEN, GEO_PROVIDER (both jobs), GEO_GEOCODER, GEO_ROUTER, NOMINATIM_URL, OSRM_URL.

Self-hosting OpenStreetMap

The public Nominatim and OSRM servers are fine for a pilot. They have usage policies (Nominatim allows about one request a second) and no uptime promise, so a city in production should run its own:

  • OSRM: download your country's extract from Geofabrik, run osrm-extract, osrm-partition and osrm-customize with the car profile, and serve it with osrm-routed. A country the size of Lithuania fits on a small VPS.
  • Nominatim: import the same extract with the official Docker image. Search results are cached by the backend (24 hours by default, GEO_SEARCH_TTL), which keeps the load low.

Then put both URLs in Maps: search and routes.

Mapbox

  • Address search uses the Search API (v6): forward geocoding biased to the market's country and to the rider's own position, and reverse geocoding for map clicks.
  • Routes use Directions (v5), driving profile, with toll roads left out when a rider asks for a toll-free trip. Its steps have the same shape as OSRM's, so the driver app's in-app navigation works the same way: the app words each turn in the driver's own language.
  • For the console's map, set NEXT_PUBLIC_MAP_TILE_URL to a Mapbox raster tile URL and NEXT_PUBLIC_MAP_TILE_ATTRIBUTION to Mapbox's required attribution when you build the admin.

The apps' maps

The rider and driver apps draw their maps with react-native-maps: the Google Maps SDK on Android and Apple Maps on iOS. The Android SDK needs a Google Maps API key in the build (GOOGLE_MAPS_API_KEY in the app's .env.production); Google does not charge for mobile native map loads. Everything the apps search or route goes through the backend, so the engines chosen above apply to the apps as well.

Turn-by-turn navigation in the driver app is built in, and a driver can also hand the trip to Google Maps, Waze or Apple Maps.

Code

  • backend/src/geo/providers/geo-engines.ts: choosing the engine, reading a Mapbox feature (no I/O).
  • backend/src/geo/providers/geo-routing.service.ts: search, reverse and routes on each engine, the minute-long cache of what the operator chose, and the Redis cache of answers (keyed by engine).
  • backend/src/geo/providers/route-steps.ts: Google and OSRM-shaped steps (OSRM and Mapbox) into the driver app's maneuvers.
  • admin/src/app/(dashboard)/providers/page.tsx: the Google, Mapbox and Maps fields.
source: docs/maps-and-routing.md (ships identically in the product zip)