Skip to main content
01

GeoThai

Zero-dependency TypeScript package for Thailand's geographic data — provinces, districts, subdistricts, and postal codes.

TypeScriptnpmThailandOpen Source
GeoThai

About

A zero-dependency TypeScript package providing structured geographic data for Thailand. Covers all provinces, districts, subdistricts, and postal codes with typed lookup and filter functions.

Features

  • Full coverage — 77 provinces, 900+ districts, 7,000+ subdistricts, and all postal codes
  • Zero runtime dependencies — ships self-contained data with no external fetches
  • Dual ESM/CJS — works in both module systems with full TypeScript type definitions
  • Filter by criterion — query by Thai name, English name, code, or any field

Usage

typescript
import {
  getAllProvinces,
  getProvinceByCode,
  getProvincesByCriterion,
} from "geothai";
 
// All provinces
const provinces = getAllProvinces();
 
// Single province by code (with auto-completion)
const bangkok = getProvinceByCode("10");
 
// Filter by Thai name
const filtered = getProvincesByCriterion({ name_th: "กรุงเทพมหานคร" });

Stats

  • 9,300+ downloads in the past year
  • v3.0.0 current release, built with tsdown
  • Requires Node.js 20+

Maintained under the GeoThai GitHub organization.