This package provides a raw JSON database of Vietnamese administrative addresses, meticulously structured according to Resolution 202/2025/QH15 and NQ-UBTVQH15, with applicability from July 1, 2025, and January 1, 2025, respectively. As of version 1.0.0, it includes data for 34 provinces/cities, 3,321 wards/communes, and 10,977 ward mapping rules. It is explicitly designed as a dependency for other JavaScript/TypeScript libraries, offering unopinionated access to the latest administrative boundary data. The package ships with comprehensive TypeScript type definitions, enabling robust static type checking for consumers. Its core differentiator is providing a directly consumable, machine-readable dataset reflecting future administrative changes.
npm install vietnam-address-databaseVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import the `vietnam-address-database` data, extract the specific 'provinces', 'wards', and 'ward_mappings' tables, and provides example functions for accessing and searching the administrative data with TypeScript types.
Be aware of the effective dates of the data. If you need current administrative data (prior to 2025), this package may not be suitable. Verify the 'created_at' and 'updated_at' fields for specific records if available, or consult official government sources for current data.
Implement custom parsing logic to iterate through the exported `addressData` array and extract the 'table' type items based on their 'name' property (e.g., 'provinces', 'wards'). Cast `item.data` to the appropriate TypeScript type (e.g., `Province[]`) for type safety.
Pin to exact major versions (`^1.0.0`) in your `package.json` and review changelogs carefully when upgrading major versions to anticipate potential schema changes in the raw data structure.
First, iterate through `addressData` to extract the specific 'table' you need (e.g., `provinces`), then apply array methods like `.find()` to the extracted table: `const provinces = addressData.find(item => item.name === 'provinces')?.data as Province[]; provinces.find(...)`
Ensure the package is installed: `npm install vietnam-address-database`. Double-check the import statement for typos: `import addressData from 'vietnam-address-database';` or `const addressData = require('vietnam-address-database');`No dependency data recorded yet.