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

@softalxhq/location-selector

v0.4.2

Published

Framework-agnostic country → state/region → LGA/district → town location data (Africa + US + UK)

Readme

@softalxhq/location-selector

Location-selecter

Framework-agnostic country → state/region → LGA/district → town location data for Nigeria, Ghana, Kenya, South Africa, Egypt, Ethiopia, Tanzania, Uganda, Rwanda, Senegal, Morocco, plus United States and United Kingdom.

JSON is the source of truth — use it from PHP, Python, Ruby on Rails, or any other language. TypeScript helpers are included for Node and browser apps.

Live demo

Try the cascading picker in the browser: https://lsdemo.vercel.app/

Deploy tip: host demo.jpg at https://lsdemo.vercel.app/demo.jpg (e.g. put it in the demo app public/ folder) so the README image loads on npm and in Markdown previews.

Install

npm install @softalxhq/location-selector
pnpm add @softalxhq/location-selector
yarn add @softalxhq/location-selector

Hierarchy

| Code | Country | getStates | getLgas | getTowns | | ---- | -------------- | ------------------- | --------------- | -------------- | | NG | Nigeria | State (37) | LGA | Town | | GH | Ghana | Region (16) | District / MMDA | Town | | KE | Kenya | County (47) | Sub-county | Ward | | ZA | South Africa | Province (9) | District | Municipality | | EG | Egypt | Governorate (27) | District | Shiyakha | | ET | Ethiopia | Region / city admin | Zone | Woreda | | TZ | Tanzania | Region (31) | District | Ward | | UG | Uganda | Region (4) | District | Sub-county | | RW | Rwanda | Province (5) | District | Sector | | SN | Senegal | Region (14) | Department | Arrondissement | | MA | Morocco | Region (10) | Province | Locality | | US | United States | State (+ DC) | County / Parish | City / town | | GB | United Kingdom | Country (4) | Local authority | Town / city |

JavaScript / TypeScript

import {
	getCountries,
	getStates,
	getLgas,
	getTowns,
} from "@softalxhq/location-selector";

getCountries();
// NG, GH, US, GB, KE, ZA, EG, ET, TZ, UG, RW, SN, MA

getStates("ZA");
getLgas("ZA", "Gauteng");
getTowns("ZA", "Gauteng", "Sedibeng");
// ["Emfuleni", "Lesedi", "Midvaal"]

getStates("EG");
getLgas("EG", "Cairo");

Name matching is case-insensitive. Unknown country/state/LGA returns [].

Raw JSON (JS)

import za from "@softalxhq/location-selector/data/za.json";
import eg from "@softalxhq/location-selector/data/eg.json";
import countries from "@softalxhq/location-selector/data/countries.json";

Files also exist for ng, gh, ke, et, tz, ug, rw, sn, ma, us, gb.

Data sources

African admin trees (GH, KE, ZA, EG, ET, TZ, UG, RW, SN, MA) are derived from Open Admin Data country datasets (CC-BY-4.0), transformed into this package’s three-level schema.

  • ZA: province → district → municipality (electoral ward numbers omitted — upstream wards are numeric IDs, not place names)
  • UG: region → district → sub-county (counties flattened)

United States: Census counties gazetteer + kelvins/US-Cities-Database.

United Kingdom: mySociety local authorities + GeoNames GB places.

Nigeria: bundled state → LGA → town data.

License

MIT. Upstream datasets retain their licenses (CC-BY-4.0 for Open Admin Data / GeoNames attribution; Census public domain; mySociety per their terms). Attribution above is required when redistributing derived data.