@mrkuntalojha/knowindia
v1.0.0
Published
A comprehensive India data package providing detailed information, metadata, and utility functions for states, union territories, capitals, districts, demographics, geography, culture, and more.
Maintainers
Readme
Know India
@mrkuntalojha/knowindiais a lightweight npm package developed by @kuntalojha that provides structured data of Indian states and union territories, including capitals, regions, and key metadata for easy use in web and backend applications.
📖 Overview
@mrkuntalojha/knowindia is a lightweight and structured npm package that provides comprehensive data about Indian states and union territories. It enables developers to easily access, manage, and integrate detailed geographical, cultural, and administrative information of India into their applications.
The package is designed for seamless use in web, mobile, and backend projects, making it ideal for dashboards, educational platforms, tourism applications, and data-driven systems.
✨ Who is it for?
- 🌐 Web Developers (tourism, travel, dashboards)
- 📊 Data Analysts (structured geography datasets)
- 📱 App Developers (location-based services)
- 🎓 Educators (India geography learning tools)
- 🏛️ Government & civic tech projects
🚀 Features
| Feature | Description | |--------|-------------| | 🗺️ India Coverage | Includes all 28 states and 8 union territories with structured and consistent data | | 🏛️ Rich Metadata | Provides key details like area, population, literacy rate, GDP (est.), and official languages | | 🎯 State Codes | Standardized short codes (e.g., AP, MH, DL) for easy access and filtering | | 🏞️ Tourism Data | Curated list of famous places, attractions, and travel highlights | | 📍 District Information | Complete district-wise mapping for each state with names and counts | | 🌸 State Symbols | Includes state animal, bird, flower, and tree for cultural reference | | 🎭 Cultural Data | Festivals, cuisine, traditions, and regional identity | | 🧠 Historical Insights | Concise history and heritage information for each state/UT | | 📊 Economic Overview | Includes GDP estimates and key economic indicators | | 🌍 Regional Classification | Categorized into Indian regions like North, South, East, West, and Northeast | | 📦 Lightweight Package | Zero dependencies for fast and efficient usage | | 🔧 Framework Friendly | Fully compatible with React, Next.js, Node.js, and other JS frameworks |
📦 Installation
To install the @mrkuntalojha/knowindia package, use npm:
npm i @mrkuntalojha/knowindiaChoose your preferred package manager:
| Manager | Installation Command |
|----------|----------------------|
| 📦 npm | npm install @mrkuntalojha/knowindia |
| 🧶 yarn | yarn add @mrkuntalojha/knowindia |
| ⚡ pnpm | pnpm add @mrkuntalojha/knowindia |
| 🥟 bun | bun add @mrkuntalojha/knowindia |
🚀 Usage Examples
Once you have installed the package, you can import it into your JavaScript file and use the provided functions to access data.
Importing the Package
- For projects using CommonJS, you can also import it as follows:
const { states, uts, India, INDIA } = require('@mrkuntalojha/knowindia');- For projects using ES6 modules, you can also import it as follows:
import { states, uts, India, INDIA } from '@mrkuntalojha/knowindia';Functions
states()
Returns an object containing data for all Indian states.
Example:
const allStates = states();
console.log(allStates);uts()
Returns an object containing data for all Union Territories in India.
const allUTs = uts();
console.log(allUTs);INDIA()
Returns a combined object that includes data for both states and UTs.
Example:
const indiaData = INDIA();
console.log(indiaData);India()
Returns the IndiaData object. The structure and data should be defined in India.js.
Example:
const indiaDetails = India();
console.log(indiaDetails); // Output: Get quick lookup of all states and UTs{
allStates: {
AP: 'Andhra Pradesh',
AR: 'Arunachal Pradesh',
AS: 'Assam',
BR: 'Bihar',
CG: 'Chhattisgarh',
GA: 'Goa',
GJ: 'Gujarat',
HR: 'Haryana',
HP: 'Himachal Pradesh',
JH: 'Jharkhand',
KA: 'Karnataka',
KL: 'Kerala',
MP: 'Madhya Pradesh',
MH: 'Maharashtra',
MN: 'Manipur',
ML: 'Meghalaya',
MZ: 'Mizoram',
NL: 'Nagaland',
OD: 'Odisha',
PB: 'Punjab',
RJ: 'Rajasthan',
SK: 'Sikkim',
TN: 'Tamil Nadu',
TG: 'Telangana',
TR: 'Tripura',
UP: 'Uttar Pradesh',
UK: 'Uttarakhand',
WB: 'West Bengal'
},
allUts: {
AN: 'Andaman and Nicobar Islands',
CH: 'Chandigarh',
DN: 'Dadra and Nagar Haveli and Daman and Diu',
LD: 'Lakshadweep',
DL: 'Delhi',
PY: 'Puducherry',
JK: 'Jammu and Kashmir',
LA: 'Ladakh'
}
}Examples:
For projects using CommonJS, you can also import it as follows:
const { states, uts, India, INDIA } = require('@mrkuntalojha/knowindia');For projects using ES6 modules, you can also import it as follows:
import { states, uts, India, INDIA } from '@mrkuntalojha/knowindia';
console.log(states()); // Logs all states data
console.log(uts()); // Logs all union territories data
console.log(INDIA()); // Logs combined data for states and UTs
const WestBengal = states().WB; // Access West Bengal data
console.log(WestBengal);
const Delhi = uts().DL; // Access Delhi data
console.log(Delhi);
📦 Node.js (CommonJS)
const { states, uts, India, INDIA } = require('@mrkuntalojha/knowindia');
// 🗺️ Get all states
const allStates = states();
console.log(allStates);
// 🏛️ Get all union territories
const allUTs = uts();
console.log(allUTs);
// 🇮🇳 Get complete India dataset
const indiaData = INDIA();
console.log(indiaData);
// 🔍 Get simplified lookup data
const lookup = India();
console.log(lookup);⚡ ES Modules (ESM)
import { states, uts, India, INDIA } from '@mrkuntalojha/knowindia';
// 🌆 Get Maharashtra data
const maharashtra = states().MH;
console.log(maharashtra);
// 🏛️ Get Delhi data
const delhi = uts().DL;
console.log(delhi);🎯 Accessing Specific Data
import { states, uts } from '@mrkuntalojha/knowindia';
// 📍 Andhra Pradesh
const andhraPradesh = states().AP;
// 🌆 Maharashtra
const maharashtra = states().MH;
// 🏛️ Delhi
const delhi = uts().DL;
console.log(andhraPradesh.name);
console.log(maharashtra.capital);
console.log(delhi.population);⚛️ React / Next.js
import { states } from '@mrkuntalojha/knowindia';
function StatesList() {
const allStates = states();
return (
<div>
{Object.entries(allStates).map(([code, state]) => (
<div key={code}>
<h3>{state.name}</h3>
<p>🏛️ Capital: {state.capital}</p>
<p>🗺️ Region: {state.region}</p>
</div>
))}
</div>
);
}
export default StatesList;🌐 Express.js API
const express = require('express');
const { states, INDIA } = require('@mrkuntalojha/knowindia');
const app = express();
// 🇮🇳 Get complete India dataset
app.get('/api/india', (req, res) => {
res.json(INDIA());
});
// 🗺️ Get state by code
app.get('/api/states/:code', (req, res) => {
const state = states()[req.params.code.toUpperCase()];
if (!state) {
return res.status(404).json({
error: 'State not found',
});
}
res.json(state);
});
// 🗺️ Get ut by code
app.get('/api/uts/:code', (req, res) => {
const ut = uts()[req.params.code.toUpperCase()];
if (!ut) {
return res.status(404).json({
error: 'UT not found',
})
}
res.json(ut);
})
app.listen(3000, () => {
console.log('🚀 Server running on port 3000');
});📊 Data Structure
State Data Example
Each state object contains comprehensive information:
Example:
const WestBengal = states().WB; // Access West Bengal data
console.log(WestBengal);Output:
{
name: 'West Bengal',
stateCode: 'WB',
capital: 'Kolkata',
region: 'East India',
area: '88,752 km²',
population: '104 million (2023 est.)',
density: '1,100 per km²',
literacyRate: '77.9%',
gdp: '₹18.0 lakh crore (2025 est.)',
sexRatio: '950 females per 1000 males',
districts: 23,
districtNames: [
'Alipurduar', 'Bankura',
'Birbhum', 'Cooch Behar',
'Dakshin Dinajpur', 'Darjeeling',
'Hooghly', 'Howrah',
'Jalpaiguri', 'Jhargram',
'Kalimpong', 'Kolkata',
'Malda', 'Murshidabad',
'Nadia', 'North 24 Parganas',
'Paschim Bardhaman', 'Paschim Medinipur',
'Purba Bardhaman', 'Purba Medinipur',
'Purulia', 'South 24 Parganas',
'Uttar Dinajpur'
],
officialLanguages: [ 'Bengali', 'English' ],
stateAnimal: 'Fishing Cat',
stateBird: 'White-throated Kingfisher',
stateFlower: 'Night-flowering Jasmine',
stateTree: 'Devil Tree',
famousFor: [
'Victoria Memorial',
'Howrah Bridge',
'Sundarbans Mangrove Forest',
'Darjeeling Tea',
'Bengali Literature and Culture',
'Durga Puja Festival',
'Rabindranath Tagore Heritage',
'Colonial Architecture',
'Art and Cinema (Tollywood)'
],
festivals: [
'Durga Puja',
'Kali Puja',
'Poila Boishakh (Bengali New Year)',
'Rath Yatra',
'Poush Mela',
'Jagaddhatri Puja'
],
cuisine: [
'Roshogolla',
'Sandesh',
'Macher Jhol',
'Shorshe Ilish',
'Mishti Doi',
'Luchi',
'Kosha Mangsho'
],
tourismHighlights: [
{
name: 'Sundarbans National Park',
type: 'UNESCO World Heritage Site',
city: 'South 24 Parganas'
},
{ name: 'Victoria Memorial', type: 'Monument', city: 'Kolkata' },
{ name: 'Howrah Bridge', type: 'Bridge', city: 'Kolkata' },
{ name: 'Darjeeling', type: 'Hill Station', city: 'Darjeeling' },
{ name: 'Kalimpong', type: 'Hill Station', city: 'Kalimpong' },
{
name: 'Dakshineswar Kali Temple',
type: 'Temple',
city: 'Kolkata'
}
],
touristAttractions: [
{
name: 'Sundarbans',
type: 'National Park',
city: 'South 24 Parganas'
},
{ name: 'Victoria Memorial', type: 'Monument', city: 'Kolkata' },
{ name: 'Howrah Bridge', type: 'Bridge', city: 'Kolkata' },
{ name: 'Darjeeling', type: 'Hill Station', city: 'Darjeeling' },
{ name: 'Kalimpong', type: 'Hill Station', city: 'Kalimpong' },
{
name: 'Kolkata City',
type: 'Metropolitan City',
city: 'Kolkata'
}
],
history: 'West Bengal has played a major role in India’s cultural, intellectual, and political history. It was the center of the Bengal Renaissance and Indian independence movement. Kolkata, the capital, was once the capital of British India. The state is globally known for its literature, art, cinema, and the grand Durga Puja festival.',
interestingFacts: [
'Sundarbans is the largest mangrove forest in the world.',
'Kolkata was the capital of British India until 1911.',
'Durga Puja is one of the largest festivals in the world.',
'Rabindranath Tagore was the first Asian Nobel laureate.',
'Darjeeling tea is one of the most famous teas globally.'
]
}UTS Data Example
Each uts object contains comprehensive information:
Example:
const Delhi = uts().DL; // Access Delhi data
console.log(Delhi);Output:
{
name: 'Delhi',
utCode: 'DL',
capital: 'New Delhi',
region: 'North India',
area: '1,484 km²',
population: '31.2 million (2023 est.)',
density: '11,320 per km²',
literacyRate: '88.7%',
gdp: '₹13.5 lakh crore (2025 est.)',
sexRatio: '868 females per 1000 males',
districts: 11,
districtNames: [
'Central Delhi',
'East Delhi',
'New Delhi',
'North Delhi',
'North East Delhi',
'North West Delhi',
'Shahdara',
'South Delhi',
'South East Delhi',
'South West Delhi',
'West Delhi'
],
officialLanguages: [ 'Hindi', 'English', 'Punjabi', 'Urdu' ],
utAnimal: 'Nilgai',
utBird: 'House Sparrow',
utFlower: 'Alamanda',
utTree: 'Jamun Tree',
famousFor: [
'India Gate',
'Red Fort',
'Qutub Minar',
'Lotus Temple',
'Chandni Chowk'
],
festivals: [ 'Diwali', 'Holi', 'Eid', 'Lohri', 'Durga Puja' ],
cuisine: [ 'Chole Bhature', 'Paratha', 'Butter Chicken', 'Biryani' ],
tourismHighlights: [
{
name: 'Red Fort',
type: 'UNESCO World Heritage Site',
city: 'Delhi'
},
{
name: 'Qutub Minar',
type: 'UNESCO World Heritage Site',
city: 'Delhi'
},
{ name: 'India Gate', type: 'War Memorial', city: 'New Delhi' }
],
touristAttractions: [
{ name: 'Red Fort', type: 'Historical Monument', city: 'Delhi' },
{ name: 'Qutub Minar', type: 'Monument', city: 'Delhi' },
{ name: 'India Gate', type: 'War Memorial', city: 'New Delhi' },
{ name: 'Lotus Temple', type: 'Temple', city: 'New Delhi' },
{
name: 'Humayun’s Tomb',
type: 'Historical Monument',
city: 'Delhi'
}
],
history: "Delhi is one of the oldest continuously inhabited cities in the world and has served as the capital of several kingdoms and empires. From the legendary city of Indraprastha mentioned in the Mahabharata to the Delhi Sultanate, Mughal Empire, and British Raj, Delhi has been a major political and cultural center. Following India's independence in 1947, New Delhi continued as the national capital and remains the administrative heart of the country.",
interestingFacts: [
'Delhi is home to three UNESCO World Heritage Sites: Red Fort, Qutub Minar, and Humayun’s Tomb.',
'New Delhi serves as the capital of India and houses Rashtrapati Bhavan, Parliament House, and the Supreme Court.',
'Chandni Chowk is one of the oldest and busiest markets in India.',
'Delhi Metro is one of the largest and most extensive metro rail networks in the world.'
]
}🔑 API Reference
| Function | Return Type | Description |
| ---------- | ----------- | ------------------------------------------------------------------------- |
| states() | Object | Returns detailed data for all 28 Indian states |
| uts() | Object | Returns detailed data for all 8 union territories |
| INDIA() | Object | Returns a complete dataset containing both states and union territories |
| India() | Object | Returns a simplified lookup object of state and UT names with their codes |
🗺️ State Codes Reference
| Code | State | Code | State | | ---- | ----------------- | ---- | ------------- | | AP | Andhra Pradesh | MN | Manipur | | AR | Arunachal Pradesh | ML | Meghalaya | | AS | Assam | MZ | Mizoram | | BR | Bihar | NL | Nagaland | | CG | Chhattisgarh | OD | Odisha | | GA | Goa | PB | Punjab | | GJ | Gujarat | RJ | Rajasthan | | HR | Haryana | SK | Sikkim | | HP | Himachal Pradesh | TN | Tamil Nadu | | JH | Jharkhand | TG | Telangana | | KA | Karnataka | TR | Tripura | | KL | Kerala | UP | Uttar Pradesh | | MP | Madhya Pradesh | UK | Uttarakhand | | MH | Maharashtra | WB | West Bengal |
🏛️ Union Territory Codes Reference
| Code | Union Territory | | ---- | ---------------------------------------- | | AN | Andaman and Nicobar Islands | | CH | Chandigarh | | DN | Dadra and Nagar Haveli and Daman and Diu | | DL | Delhi | | JK | Jammu and Kashmir | | LA | Ladakh | | LD | Lakshadweep | | PY | Puducherry |
Coverage: 28 States • 8 Union Territories • 36 Administrative Regions
🤝 Contributing
Contributions to the @mrkuntalojha/knowindia package are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request.
🚀 Future Updates
The following enhancements are planned for upcoming releases:
- 🏞️ Expanded tourism data for states and union territories
- 📍 Detailed district-wise tourist attractions and destinations
- 🏛️ Historical monuments, heritage sites, and cultural landmarks
- 🎒 Travel and tourism highlights for major districts and cities
- 🗺️ Enhanced location-based data for tourism applications
Future features and priorities may evolve based on project requirements and community feedback.
📄 License
This project is licensed under the MIT License.
👨💻 Author
KUNTAL OJHA
- GitHub: @kuntalojha
- npm: @kuntalojha
- LinkedIn:@mrkuntalojha
- Twitter (X): @kuntalojha
- Instagram:@mrkuntalojha
