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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@yambwa/ussd-lab

v0.1.1

Published

A USSD flow simulator and testing lab for developers – design, run, and debug USSD menus without connecting to a mobile network.

Readme

@yambwa/ussd-lab

A USSD flow simulator and testing lab for developers – design, run, and debug USSD menus without connecting to a mobile network.

Overview

USSD is widely used across Africa for mobile money, banking, utilities, and government services. However, developers face challenges:

  • Dependence on slow, limited, or unstable aggregator sandboxes
  • Repetitive manual testing (dial → press keys → repeat)
  • Difficulty visualizing the full menu tree and testing edge cases
  • Lack of standard devtools for USSD flows (like Postman for APIs)

@yambwa/ussd-lab is the missing devtool for USSD. Before you deploy to a telco or aggregator, debug and test it locally.

GitHub: https://github.com/YambwaImwaka/ussd-lab
NPM: https://www.npmjs.com/package/@yambwa/ussd-lab

Features

1. Define USSD Flows in Code

Describe your USSD menu as a set of screens with logic:

const bankMenu = createApp({
  entryScreenId: 'main_menu',
  screens: {
    main_menu: {
      text: 'Welcome to MyBank\n1. Balance\n2. Transfer\n0. Exit',
      on: {
        '1': 'check_balance',
        '2': 'transfer_menu',
        '0': END_SESSION,
      },
    },
    check_balance: {
      text: 'Your balance is $100\n0. Back',
      on: {
        '0': 'main_menu',
      },
    },
    transfer_menu: {
      text: 'Enter recipient phone:\n(or press 0 to cancel)',
      on: {
        '0': 'main_menu',
      },
      handler: async (input) => {
        // Custom logic to validate phone and move to next screen
        return { nextScreen: 'transfer_confirm', session: {} };
      },
    },
  },
});

2. Simulate Full USSD Sessions

Run a session with a sequence of inputs and inspect the results:

const simulator = new Simulator(bankMenu);
const session = await simulator.run(['1', '0']); // User presses 1, then 0

console.log(session.transcript); // [main_menu, check_balance, main_menu]
console.log(session.outputs); // ["Welcome to MyBank...", "Your balance is..."]
console.log(session.ended); // false (user can still interact)

3. Testing Support

Write automated tests for your USSD flows:

import { describe, it, expect } from 'vitest';
import { Simulator } from '@yambwa/ussd-lab/simulator';
import { assertScreen, assertEnded } from '@yambwa/ussd-lab/testing';

describe('Bank Menu', () => {
  it('should show balance when user presses 1', async () => {
    const sim = new Simulator(bankMenu);
    const session = await sim.run(['1']);
    
    assertScreen(session, 'check_balance');
    expect(session.outputs[1]).toContain('Your balance');
  });

  it('should return to main menu when pressing 0', async () => {
    const sim = new Simulator(bankMenu);
    const session = await sim.run(['1', '0']);
    
    assertScreen(session, 'main_menu');
  });

  it('should end session when exiting', async () => {
    const sim = new Simulator(bankMenu);
    const session = await sim.run(['0']);
    
    assertEnded(session);
  });
});

Target Users

  • Backend developers building USSD apps for banks, mobile money, NGOs, government
  • Fintech engineers handling payment flows, balance checks, utility payments
  • Integrators & aggregators needing a way to test flows internally
  • QA engineers wanting repeatable, automated USSD testing

Project Structure

src/
├── core/              # Types, validation, USSD app definition
├── simulator/         # Session simulation engine
├── testing/           # Jest/Vitest test helpers
└── playground/        # (Future) React web UI for flow testing

Installation

npm install @yambwa/ussd-lab

Quick Start

import { createApp, Simulator } from '@yambwa/ussd-lab';

const app = createApp({
  entryScreenId: 'welcome',
  screens: {
    welcome: {
      text: 'Hello!\n1. Continue',
      on: { '1': 'end' },
    },
    end: {
      text: 'Goodbye!',
      on: {},
    },
  },
});

const sim = new Simulator(app);
const session = await sim.run(['1']);
console.log(session); // Full transcript of the session

Roadmap

  • [ ] Visual flow editor (drag-and-drop USSD flows)
  • [ ] Export flows to aggregator-specific formats
  • [ ] Analytics on simulated sessions (user dropoff points)
  • [ ] Multi-language USSD support
  • [ ] Integration examples with real USSD providers
  • [ ] React playground component

License

MIT

Contributing

Contributions welcome! Please open an issue or submit a pull request on GitHub.

Resources

  • Repository: https://github.com/YambwaImwaka/ussd-lab
  • Package: https://www.npmjs.com/package/@yambwa/ussd-lab
  • Issues: https://github.com/YambwaImwaka/ussd-lab/issues
  • Discussions: https://github.com/YambwaImwaka/ussd-lab/discussions