npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@navigatr/web

v1.0.0

Published

Browser SDK for maps, routing, and navigation with MapLibre GL JS - the open source alternative to Google Maps

Readme

@navigatr/web

Browser SDK for maps, routing, and navigation with MapLibre GL JS - the open source alternative to Google Maps. No API keys required.

Installation

npm install @navigatr/web

CSS is automatically injected - no external stylesheet needed.

Basic Usage

import { Navigatr } from '@navigatr/web'

const nav = new Navigatr()

// Render map
const map = nav.map({ container: 'map', center: { lat: 5.6037, lng: -0.1870 } })

// Geocode addresses
const origin = await nav.geocode({ address: 'Accra Mall, Ghana' })
const destination = await nav.geocode({ address: 'Kotoka Airport, Ghana' })

// Get route and draw it
const result = await nav.route({ origin, destination })
map.addMarker({ ...origin, label: 'Origin' })
map.addMarker({ ...destination, label: 'Destination' })
map.drawRoute(result.polyline)
map.fitRoute(result.polyline)

console.log(result.durationText) // "12 mins"
console.log(result.distanceText) // "3.2 km"

Ride-Sharing Apps

Use RideSession for complete ride lifecycle management:

import { Navigatr } from '@navigatr/web'

const nav = new Navigatr()
const map = nav.map({ container: 'map', center: riderLocation })

// 1. Geocode destination once when ride is requested
const destination = await nav.geocode({ address: 'Airport' })

// 2. Create ride session
const ride = nav.createRide({
  pickup: riderGPSLocation,
  destination,
  map,
  onETAUpdate: (eta, phase) => {
    showETA(eta.durationText)
  }
})

// 3. Start tracking when driver accepts
await ride.startPickup(driverLocation)

// 4. Connect real-time updates (your backend)
websocket.on('driver-location', (pos) => {
  ride.updateDriverLocation(pos)
})

// 5. Phase transitions
await ride.startTrip()  // Driver picked up rider
ride.complete()          // Arrived

Turn-by-Turn Directions

const route = await nav.route({
  origin,
  destination,
  maneuvers: true
})

route.maneuvers.forEach(step => {
  console.log(step.instruction) // "Turn left onto Main Street"
  console.log(step.type)        // "left"
})

Real-Time Tracking (Manual)

For custom real-time implementations:

// Register callback for location updates
nav.onLocationUpdate(async (driverPos) => {
  map.updateDriverMarker({ ...driverPos, icon: 'car' })

  const updated = await nav.recalculateETA(driverPos, destination)
  etaDisplay.textContent = updated.durationText

  map.clearRoute()
  map.drawRoute(updated.polyline)
})

// Connect to your backend
firebase.database().ref(`rides/${rideId}/driverLocation`).on('value', (snap) => {
  nav.pushLocationUpdate(snap.val())
})

API

Navigatr

| Method | Description | |--------|-------------| | map(config) | Create a MapLibre GL map | | geocode({ address }) | Convert address to coordinates | | reverseGeocode({ lat, lng }) | Convert coordinates to address | | route(options) | Calculate route between points | | createRide(config) | Create ride session for ride-sharing | | onLocationUpdate(callback) | Register location update callback | | pushLocationUpdate(location) | Push driver location to callbacks | | recalculateETA(current, dest) | Recalculate route from position |

NavigatrMap

| Method | Description | |--------|-------------| | addMarker({ lat, lng, label? }) | Add marker with optional popup | | drawRoute(polyline) | Draw route line (#00FF94) | | fitRoute(polyline) | Fit map to show route | | clearRoute() | Remove route from map | | updateDriverMarker(options) | Add/update driver marker | | removeDriverMarker() | Remove driver marker | | panTo(location) | Pan map to location |

RideSession

| Method | Description | |--------|-------------| | startPickup(driverLocation) | Start pickup phase | | startTrip() | Start trip phase | | complete() | Mark ride complete | | updateDriverLocation(pos) | Update driver position | | getPhase() | Get current phase | | getCurrentRoute() | Get last calculated route |

Documentation

License

MIT