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

india-location-kit

v1.0.0

Published

Offline India States, Districts and Cities dataset with fast search support

Downloads

152

Readme

india-location-data

A lightweight, offline, zero-dependency Node.js package for Indian States, Districts, and Cities.

Built for developers who need fast and reliable location data without external APIs.

Features

  • Complete India States dataset
  • Complete India Districts dataset
  • Complete India Cities dataset
  • Offline JSON data
  • Zero dependencies
  • Fast in-memory search
  • TypeScript support
  • ES Modules (ESM)
  • Tree-shakeable exports
  • Production-ready

Installation

npm install india-location-data

Quick Start

import {
  getStates,
  getDistricts,
  search
} from "india-location-data";

const states = getStates();

const districts = getDistricts("UP");


const results = search("noida");

API Reference

getStates()

Returns all Indian States and Union Territories.

Example

import { getStates } from "india-location-data";

const states = getStates();

Response

[
  {
    code: "UP",
    name: "Uttar Pradesh",
    type: "STATE"
  }
]

getStateByCode(code)

Returns a state by its code.

Example

import { getStateByCode } from "india-location-data";

const state = getStateByCode("UP");

Response

{
  code: "UP",
  name: "Uttar Pradesh",
  type: "STATE"
}

getDistricts(stateCode)

Returns all districts belonging to a state.

Example

import { getDistricts } from "india-location-data";

const districts = getDistricts("UP");

Response

[
  {
    code: "GBN",
    stateCode: "UP",
    name: "Gautam Buddha Nagar"
  }
]

getDistrictByCode(code)

Returns a district by district code.

Example

import { getDistrictByCode } from "india-location-data";

const district = getDistrictByCode("GBN");

search(keyword)

Search across States, Districts.

Example

import { search } from "india-location-data";

const results = search("noida");

Response

[
  {
    type: "city",
    code: "NOIDA",
    name: "Noida",
    state: "Uttar Pradesh",
    district: "Gautam Buddha Nagar"
  }
]

search(keyword, options)

Example

search("uttar", {
  type: "state"
});
search("gautam", {
  type: "district"
});
search("noida", {
  type: "city"
});

Options

| Property | Type | Default | | -------- | ------ | ------- | | limit | number | 20 | | type | string | null |


TypeScript Support

Fully supported.

Example

import {
  getStates,
  State
} from "india-location-data";

const states: State[] = getStates();

Available Types

State
District
City
SearchResult
SearchOptions

Data Structure

State

{
  code: string;
  name: string;
  type: "STATE" | "UT";
}

District

{
  code: string;
  stateCode: string;
  name: string;
}

City

{
  code: string;
  districtCode: string;
  stateCode: string;
  name: string;
}

Performance

The package uses in-memory indexes for fast lookups.

Features include:

  • O(1) code-based lookups
  • Indexed district retrieval
  • Indexed city retrieval
  • Optimized search ordering
  • No database required
  • No network calls

Use Cases

  • HRMS Systems
  • ERP Platforms
  • E-Commerce Applications
  • Government Portals
  • Logistics Applications
  • CRM Systems
  • School Management Systems
  • Form Builders
  • SaaS Platforms

Browser Support

Supported in:

  • Node.js 18+
  • Node.js 20+
  • Node.js 22+
  • Modern Browsers
  • Vite
  • Next.js
  • React
  • Vue
  • Angular

Contributing

Contributions are welcome.

If you find incorrect location data or want to improve the package:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Open a Pull Request

Roadmap

Version 1.0

  • States
  • Districts
  • Cities
  • Search
  • TypeScript Support

Version 1.1

  • State Search
  • District Search
  • City Search Enhancements

Version 1.2

  • Pincode Lookup
  • Reverse Lookup

Version 2.0

  • Talukas
  • Villages
  • Constituencies

License

MIT License


Made with ❤️ for the Indian developer community.