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

@techvius/bd-geo-address

v1.0.3

Published

Bangladesh administrative hierarchy (Division → Zilla → Thana) lookup data and functions, zero runtime dependencies.

Readme

@techvius/bd-geo-address

npm version npm downloads license

Bangladesh's administrative hierarchy — Division → Zilla (District) → Thana (Upazila) — as static data with three lookup functions. Zero runtime dependencies, works in Node.js (CommonJS and ESM) and any bundler/browser.

Scope

This package intentionally covers only Division/Zilla/Thana names and their parent-child relationships. It does not include Bangla names, postal codes, union-level data, or geocoding. If you need those, see bd-geo-address (unrelated, unscoped package with a broader feature set).

Install

npm install @techvius/bd-geo-address

Usage

import {
  getAllDivision,
  getZillaByDivisionId,
  getThanaByZillaId,
} from "@techvius/bd-geo-address";

getAllDivision();
// [
//   { id: 1, name: "Dhaka" },
//   { id: 2, name: "Barishal" },
//   { id: 3, name: "Khulna" },
//   { id: 4, name: "Sylhet" },
//   { id: 5, name: "Mymensingh" },
//   { id: 6, name: "Chittagong" },
//   { id: 7, name: "Rajshahi" },
//   { id: 8, name: "Rangpur" },
// ]

getZillaByDivisionId(1); // Dhaka's zillas
// [
//   { id: 1, name: "Narshingdi", division_id: 1 },
//   { id: 2, name: "Narayanganj", division_id: 1 },
//   { id: 4, name: "Gazipur", division_id: 1 },
//   ...
// ]

getThanaByZillaId(1); // Narshingdi's thanas
// [
//   { id: 1, name: "Narshingdi Sadar", zilla_id: 1 },
//   { id: 2, name: "Madhabdi", zilla_id: 1 },
//   ...
// ]

Works identically with require(...):

const { getAllDivision } = require("@techvius/bd-geo-address");

A common use case is populating cascading dropdowns in an address form: fetch divisions, let the user pick one, call getZillaByDivisionId with its id, then getThanaByZillaId once a zilla is picked.

API reference

getAllDivision(): Division[]

Returns all 8 divisions of Bangladesh.

getZillaByDivisionId(divisionId: number): Zilla[]

Returns all zillas belonging to divisionId. Returns [] if divisionId doesn't match any division — it never throws.

| Parameter | Type | Description | | ------------ | -------- | ----------------------------------------------- | | divisionId | number | The id of a division from getAllDivision(). |

getThanaByZillaId(zillaId: number): Thana[]

Returns all thanas belonging to zillaId. Returns [] if zillaId doesn't match any zilla — it never throws.

| Parameter | Type | Description | | --------- | -------- | --------------------------------------------------- | | zillaId | number | The id of a zilla from getZillaByDivisionId(). |

Types

interface Division {
  id: number;
  name: string;
}

interface Zilla {
  id: number;
  name: string;
  division_id: number;
}

interface Thana {
  id: number;
  name: string;
  zilla_id: number;
}

Data

8 divisions, 64 zillas, 554 thanas. Sourced from Bangladesh's official administrative division list. IDs are stable integers assigned in a fixed order and won't change between versions of this package (adding new entries only appends new ids; it never renumbers existing ones).

Contributing

Contributions are welcome — bug fixes, data corrections, and small improvements in particular.

Setup

git clone https://github.com/moniruzzamanrony/bd-geo-address.git
cd bd-geo-address
npm install

Project layout

  • data-source/data.xlsx — the source spreadsheet for the administrative hierarchy.
  • scripts/build-data.ts — generates the files under src/data from data-source/data.xlsx. Run it with npm run build:data after editing the spreadsheet.
  • src/ — package source (index.ts, types.ts, generated data/).
  • test/ — Vitest test suite, including a data-integrity check that validates every zilla/thana references a valid parent id.

Workflow

  1. Fork the repo and create a branch off main.
  2. Make your change. If it touches the administrative data, edit data-source/data.xlsx and regenerate with npm run build:data rather than hand-editing files in src/data.
  3. Run the checks locally before opening a PR:
    npm run lint   # tsc --noEmit
    npm test       # vitest run
    npm run build  # tsup
  4. Open a pull request describing the change and, for data changes, the source you used to verify it.

Guidelines

  • Keep the package's scope in mind — this repo intentionally does not include Bangla names, postal codes, union-level data, or geocoding.
  • Existing ids are stable and must never be renumbered or reused; new entries are appended.
  • No runtime dependencies — keep dependencies empty.

Reporting issues

Use GitHub Issues for bugs, incorrect data, or feature requests.

License

MIT © Moniruzzaman Rony