fake-data-in
v1.0.2
Published
Indian fake data generator — names, phones, addresses, UPI, PAN, Aadhaar, companies and more. Zero dependencies.
Maintainers
Readme
fake-data-in 🌏
International fake data generator — names, phones, addresses, emails, IDs and more. Works for 13 countries/locales. Zero dependencies.
Why?
faker.js exists but returns "John Smith" in your Indian app and "+1-555-234" for an Indian phone.
fake-data-in generates data that actually looks right for each country.
⚠️ Important — Phone Numbers
Generated phone numbers follow real-world formats and may coincidentally match a real number.
For testing environments where this matters, use { safe: true } — generates numbers in
telecom-authority-reserved ranges that are never assigned to real users:
fake.phone('in') // "+91 98765 43210" ← real format, might match real user
fake.phone('in', { safe: true }) // "+91 00053 02485" ← TRAI unallocated, guaranteed fake
fake.safePhone('in') // same as above, shorthand| Locale | Safe Range Used | Authority |
|---|---|---|
| 🇮🇳 India | +91 000xx xxxxx | TRAI — unallocated prefix |
| 🇺🇸 US | +1 (555) 010x xxxx | FCC — reserved for fiction |
| 🇬🇧 UK | +44 7700 9xxxxx | Ofcom — drama/fiction reserved |
| Others | +xx 0000x xxxxxxx | Universally unallocated prefix |
This package is intended for development and testing only.
Install
npm install fake-data-inQuick Start
import { fake } from 'fake-data-in';
// Default locale: India
fake.name() // "Rohit Sharma"
fake.phone() // "+91 98765 43210"
fake.email() // "[email protected]"
fake.address() // "42, Gandhi Colony, Lucknow, Uttar Pradesh 226001, India"
// Other locales
fake.name(null, 'us') // "Michael Johnson"
fake.phone('uk') // "+44 7911 123456"
fake.address('de') // "42 Hauptstraße, Berlin, Berlin 10001, Germany"Supported Locales
| Code | Country | Code | Country |
|------|---------|------|---------|
| in | 🇮🇳 India (default) | jp | 🇯🇵 Japan |
| us | 🇺🇸 United States | br | 🇧🇷 Brazil |
| uk | 🇬🇧 United Kingdom | cn | 🇨🇳 China |
| de | 🇩🇪 Germany | ng | 🇳🇬 Nigeria |
| fr | 🇫🇷 France | es | 🇪🇸 Spain |
| au | 🇦🇺 Australia | it | 🇮🇹 Italy |
| ca | 🇨🇦 Canada | | |
fake.locales() // ['in','us','uk','de','fr','jp','br','cn','ng','es','it','au','ca']Full API
Names
fake.name() // "Rahul Sharma" (India, default)
fake.name(null, 'us') // "Michael Johnson" (USA)
fake.name('male', 'uk') // "Oliver Smith" (UK male)
fake.name('female', 'jp') // "Tanaka Hina" (Japan female, last first)
fake.firstName(null, 'de') // "Thomas"
fake.lastName('fr') // "Dubois"
fake.maleName('br') // "Lucas Silva"
fake.femaleName('es') // "María García"Contact
// ── Phone ─────────────────────────────────────────────────────────────────────
fake.phone() // "+91 98765 43210" (India, default)
fake.phone('us') // "+1 (212) 555-7890"
fake.phone('uk') // "+44 7700 900123"
fake.phone('de') // "+49 030 1234567"
fake.phone('jp') // "+81 90-1234-5678"
// Safe mode — guaranteed not a real number (uses reserved/unallocated ranges)
fake.phone('in', { safe: true }) // "+91 00053 02485"
fake.phone('us', { safe: true }) // "+1 (555) 0102-1768"
fake.phone('uk', { safe: true }) // "+44 7700 910678"
fake.safePhone('in') // shorthand for safe: true
// ── Other ─────────────────────────────────────────────────────────────────────
fake.email() // "[email protected]"
fake.email(null,'uk') // "[email protected]"
fake.username() // "rohit_sharma42"
fake.website('uk') // "https://www.techpro.co.uk"
// India only
fake.upi() // "rohit.sharma@okaxis"
// Universal
fake.ipv4() // "192.168.1.42"
fake.ipv6() // "2001:0db8:85a3:0000:..."
fake.macAddress() // "00:1A:2B:3C:4D:5E"Location
fake.city() // "Lucknow"
fake.city('us') // "San Francisco"
fake.state('uk') // "England"
fake.country('de') // "Germany"
fake.address() // "326, Gandhi Colony, Lucknow, UP 226001, India"
fake.address('us') // "42 Oak Street, Los Angeles, California 90002, United States"
fake.zipCode('uk') // "EC1A 1BB"
fake.pincode() // "226001" (India alias for zipCode)
fake.cityWithState('au') // { city: 'Sydney', state: 'New South Wales', country: 'Australia', countryCode: 'AU' }
fake.timezone() // "Asia/Kolkata"
fake.currencyCode('uk') // "GBP"
fake.currencySymbol('de') // "€"India Documents
fake.pan() // "ABCDE1234F"
fake.pan('company') // "ABCCE1234F" (4th char = C)
fake.aadhaar() // "412356789012"
fake.aadhaar({ masked: true }) // "XXXX-XXXX-9012"
fake.aadhaar({ dashes: true }) // "4123-5678-9012"
fake.gst() // "09ABCDE1234F1ZG"
fake.ifsc() // "HDFC0ABC123"
fake.vehicleNumber() // "UP32 AB 1234"
fake.passport() // "A1234567"
fake.voterId() // "ABC1234567"
fake.bankAccount() // "912345678901"Business
fake.company() // "Sterling Solutions Pvt Ltd"
fake.company({ real: true }) // "Tata Consultancy Services" (real Indian company)
fake.designation() // "Senior Software Engineer"
fake.industry() // "Information Technology"
fake.salary() // 1200000
fake.salary({ formatted: true }) // "₹12.0 LPA"
fake.employeeId() // "EMP04823"Date & Time
fake.dob() // Date object
fake.dob({ format: 'DD/MM/YYYY' }) // "15/08/1995"
fake.dob({ format: 'YYYY-MM-DD' }) // "1995-08-15"
fake.dob({ format: 'MM/DD/YYYY' }) // "08/15/1995" (US format)
fake.dob({ minAge: 18, maxAge: 30 }) // young adult
fake.age() // 28
fake.age({ min: 18, max: 25 }) // 22
fake.pastDate(30) // Date 30 days ago
fake.futureDate(90) // Date 90 days ahead
fake.recentDate({ days: 7 }) // Date within last 7 daysMoney
fake.amount() // 45230
fake.amount({ min: 100, max: 5000 }) // 3421
fake.amount({ formatted: true, symbol: '₹' }) // "₹45,230"
fake.price() // 999
fake.price({ formatted: true, symbol: '$' }) // "$49.99"IDs & Tokens
fake.otp() // "482930" (6 digits, default)
fake.otp(4) // "8291" (4 digits)
fake.pin() // "4821" (4 digit PIN)
fake.token() // "Kj8xP2mNqR..." (32 chars)
fake.token(64) // (64 chars)
fake.uuid() // "a4857486-919b-4e63-b316-f1133ad49ec8"
fake.cuid() // "cl9ebqhxk000009jr..."
fake.objectId() // "507f1f77bcf86cd799439011"Text & Misc
fake.gender() // "Male" or "Female"
fake.gender({ binary: false }) // "Non-binary", "Prefer not to say" also possible
fake.boolean() // true or false
fake.number(1, 100) // 42
fake.float(0, 1, 4) // 0.7231
fake.color() // "Blue"
fake.color({ format: 'hex' }) // "#A46CE6"
fake.word() // "swift"
fake.sentence() // "The quick api process data module."
fake.lorem() // 3 sentences
fake.lorem(5) // 5 sentences
fake.url() // "https://www.techpro.io"
fake.slug() // "fast-api-4821"
fake.hashtag() // "#nodejs"
fake.oneOf(['a', 'b', 'c']) // "b"
fake.manyOf(['a', 'b', 'c', 'd'], 2) // ['d', 'b']Complete Profiles
// India profile (default)
fake.person()
// {
// id: "uuid...",
// name: "Rohit Sharma",
// gender: "Male",
// age: 28,
// dob: "1998-03-15",
// email: "[email protected]",
// phone: "+91 98765 43210",
// address: "42, Gandhi Colony, Mumbai, Maharashtra 400001, India",
// pan: "ABCDE1234F",
// aadhaar: "XXXX-XXXX-9012",
// upi: "rohit.sharma@okaxis"
// }
// USA profile
fake.person({ locale: 'us' })
// With work details
fake.person({ locale: 'in', withWork: true })
// Adds: company, designation, employeeId, salary
// Without documents (India)
fake.person({ locale: 'in', withDocuments: false })
// Generate 100 profiles
fake.persons(100, { locale: 'us' })
// Mixed locales
const users = [
...fake.persons(50, { locale: 'in' }),
...fake.persons(30, { locale: 'us' }),
...fake.persons(20, { locale: 'uk' }),
]CLI Usage
# Single value
npx fake-data-in name
npx fake-data-in phone
npx fake-data-in pan
npx fake-data-in uuid
# Multiple values
npx fake-data-in phone --count=5
# JSON output
npx fake-data-in person --json
# All available types
npx fake-data-inTree-shakeable Named Imports
import { pan, aadhaar, gst } from 'fake-data-in';
import { phone, safePhone } from 'fake-data-in';
import { email } from 'fake-data-in';
import { uuid, otp, token } from 'fake-data-in';
import { person, persons } from 'fake-data-in';Common Use Cases
Seed a database
import { fake } from 'fake-data-in';
const users = fake.persons(500, { locale: 'in', withWork: true });
await db.users.insertMany(users);Unit tests
import { fake } from 'fake-data-in';
it('should validate PAN', () => {
const pan = fake.pan();
expect(isValidPAN(pan)).toBe(true);
});
it('should register a user', async () => {
const user = {
name: fake.name(),
email: fake.email(),
phone: fake.safePhone(), // safe: guaranteed not a real number
otp: fake.otp(),
};
const result = await registerUser(user);
expect(result.success).toBe(true);
});React UI with realistic data
import { fake } from 'fake-data-in';
const demoUsers = fake.persons(10, { locale: 'in' });
export function UserList() {
return demoUsers.map(u => (
<UserCard key={u.id} name={u.name} email={u.email} city={u.city} />
));
}Changelog
v1.0.2
- Added
{ safe: true }option tophone()— generates numbers in telecom-authority-reserved ranges, guaranteed never assigned to real users - Added
safePhone(locale)as a dedicated shorthand - Safe ranges: TRAI (India), FCC (US), Ofcom (UK), unallocated prefixes for all other locales
License
MIT © Adarsh
Contributing
Issues, bugs, ideas — all welcome! Want a new locale? Open a PR — locale files are tiny and easy to add.
