NIK Generator ID - Generate Indonesian NIKs Like a Boss 🇮🇩
Meet NIK Generator ID — a handy JS/TS package to whip up random or custom Indonesian NIKs for testing and development. Because manually typing 16-digit IDs is so old.
NIK Generator ID: Generate Indonesian NIKs Like a Boss 🚀
Tired of manually crafting fake Indonesian identity numbers (NIK) for your dev projects? Yeah, me too. That’s why I built NIK Generator ID — a lightweight JavaScript/TypeScript package that lets you generate valid-looking Indonesian NIKs, either random or tailored to your needs.
If you’re working on anything involving mock user data in Indonesia — say, an e-KTP app, test automation, or just building cool stuff — this package will save you serious time.
So… What is NIK Generator ID? 🤔
NIK Generator ID is a utility package that spits out random or user-customized Indonesian National Identity Numbers (aka NIKs). It’s built on real regional data — provinces, cities, districts — so you get properly structured, semi-realistic NIKs for all your testing needs.
It’s not official, but it sure looks like it. Perfect for devs who want realism without the legal drama.
Install It ⚙️
Pop open your terminal and run:
npm install nik-generator-id
Then, bring it into your code like so:
If you’re using ES Modules
import { generateNik, getProvinces, getRegencies, getDistricts } from 'nik-generator-id';
If you’re stuck with CommonJS
const { generateNik, getProvinces, getRegencies, getDistricts } = require('nik-generator-id');
What Makes It Awesome? ✨
Here’s why this package might just become your new best friend:
- Random NIKs: One function call. Boom. You got a 16-digit NIK.
- Fully Customizable: Gender, birthdate, region — all yours to control.
- Actual Regional Data: Based on Indonesia’s administrative divisions.
- Follows the Official Format: 16 digits, properly structured.
- Tiny & Simple: No bloat, just works.
Quick Demos 🛠️
Generate a Random NIK
const nik = generateNik();
console.log(nik); // e.g., 3273081505900001
Generate NIK for a Male
const maleNik = generateNik({ gender: 'male' });
console.log(maleNik);
Generate NIK for a Female Born Jan 15, 1990
const femaleNik = generateNik({
gender: 'female',
birthDate: new Date(1990, 0, 15)
});
console.log(femaleNik);
Generate NIK for a Specific Location
const specificNik = generateNik({
provinceCode: '32', // West Java
regencyCode: '73', // Bandung City
districtCode: '08' // Specific district
});
console.log(specificNik);
Dig Into the Regional Data 🗺️
You can also fetch lists of regions if you need to build location pickers or just want more control:
Get Provinces
const provinces = getProvinces();
console.log(provinces);
// [{ code: '11', name: 'Aceh' }, ...]
Get Regencies in a Province
const regencies = getRegencies('11'); // Aceh
console.log(regencies);
Get Districts in a Regency
const districts = getDistricts('11', '01'); // Aceh Selatan
console.log(districts);
How the NIK Format Works 🔢
Each NIK is 16 digits long and follows this structure:
PPRRDDTTMMYYXXXX
Where:
PP
: Province code (2 digits)RR
: Regency/City code (2 digits)DD
: District code (2 digits)TT
: Day of birth (add 40 if female)MM
: Birth monthYY
: Last two digits of birth yearXXXX
: Random sequence
Example: 3273081505900001
means West Java, Bandung City, district 08, born May 15, 1990, and sequence 0001.
A Few Caveats ⚠️
- Not for real-world use: This is strictly for testing/dev purposes.
- Data is accurate: Based on actual regional codes.
- Contributions welcome: Bugs, ideas, or feature requests? PRs and issues on GitHub are always appreciated.
Why Bother With This? 🌟
- Save Time: No more hand-coding fake NIKs.
- Look Legit: Great for tests and demos.
- Highly Customizable: Works the way you need it to.
- Open Source: MIT licensed and totally free.
Try It Out 🚀
Ready to fake it like a pro?
npm install nik-generator-id
Check out the full docs and code on GitHub.
Happy coding! And may your fake IDs never get flagged 😎