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

zenbus

v2.1.0

Published

Real-time next bus ETA from Zenbus networks via direct API (protobuf)

Readme

zenbus

Real-time next bus ETA from Zenbus networks.

Pure JavaScript ES module — calls the Zenbus API directly using protobuf. No browser, no scraping, no native dependencies.

Requirements

  • Node.js ≥ 18

Install

npm install zenbus

Or globally for CLI usage:

npm install -g zenbus

JavaScript API

zenbus exports an ES module you can import directly.

import { createClient } from 'zenbus';

const client = await createClient({
  alias: 'gpso',
  itinerary: '5426824545828864',
  stop: '5366312231501824',
});

console.log(client.stopName); // e.g. "Main Square"
console.log(client.lineCode); // e.g. "L1"

const data = await client.poll();
console.log(data);

createClient(options)

Returns a Promise<ZenbusClient>.

| Parameter | Type | Description | |---|---|---| | alias | string | Network alias (e.g. gpso) | | itinerary | string | Itinerary ID | | stop | string | Stop ID | | signal | AbortSignal | Optional — cancel in-flight requests |

client.poll()

Returns a Promise<PollResult>:

{
  stop: 'Main Square',       // stop name
  line: 'L1',                // line code
  timestamp: '2026-04-11T…', // ISO poll timestamp
  now: '14h35',              // current time (HhMM)
  first: {                   // closest upcoming bus, or null
    eta: 4,                  // minutes
    distance: 1200,          // metres
    estimatedArrival: '2026-04-11T14:39:00.000Z',
    scheduledTime: '2026-04-11T14:42:00.000Z',  // null if no schedule data
    isLive: true,            // true = real-time GPS, false = scheduled
  },
  next: { … } | null,       // second live bus if available
}

Cancellation

const ac = new AbortController();

const client = await createClient({
  alias: 'gpso',
  itinerary: '…',
  stop: '…',
  signal: ac.signal,
});

// later
ac.abort();

CLI

zenbus --alias gpso --itinerary 5426824545828864 --stop 5366312231501824

Options

| Option | Env var | Description | Default | |---|---|---|---| | --alias | ZENBUS_ALIAS | Network alias | required | | --itinerary | ZENBUS_ITINERARY | Itinerary ID | required | | --stop | ZENBUS_STOP | Stop ID | required | | --interval | ZENBUS_INTERVAL | Poll interval in seconds | 10 | | --output | — | terminal or json | terminal |

Terminal output

Live-updating display with real-time ETA, distance, scheduled time, and 2nd bus when available. Press Ctrl+C to quit.

JSON output

zenbus --alias gpso --itinerary … --stop … --output json

Prints one JSON object per poll cycle to stdout — pipe to jq, log to file, or feed into another process.

{
  "stop": "Main Square",
  "line": "L1",
  "timestamp": "2026-04-11T14:35:12.345Z",
  "now": "14h35",
  "first": {
    "eta": 4,
    "distance": 1200,
    "estimatedArrival": "2026-04-11T14:39:00.000Z",
    "scheduledTime": "2026-04-11T14:42:00.000Z",
    "isLive": true
  },
  "next": {
    "eta": 12,
    "distance": 3400,
    "estimatedArrival": "2026-04-11T14:47:00.000Z",
    "scheduledTime": "2026-04-11T14:50:00.000Z",
    "isLive": true
  }
}

Tests

npm test

Uses Node's built-in test runner — no extra test dependencies.

Finding your IDs

Open your stop on zenbus.net. The URL contains everything you need:

https://zenbus.net/publicapp/web/{alias}?line=…&stop={stop}&itinerary={itinerary}

License

MIT