Skip to content

dawit-io/it-faker

Repository files navigation

🇮🇹 Faker IT

Generate authentic Italian fake data with real demographic distributions and formatting. Perfect for testing apps that need that genuine Italian touch! 🍝

⚠️ Development Status: This library is currently under active development. Features may be incomplete, APIs might change, and some links/references are not yet functional. Feel free to try it out and contribute, but please note it's not yet production-ready!

npm version License: MIT Coverage Status

🌟 Highlights

  • Complete Italian Personal Profiles - Generate full profiles with consistent data
  • Real Geographic Data - Actual Italian cities, provinces, and regions
  • Smart Fiscal Codes - Valid codice fiscale generation
  • Professional Titles - Including proper Italian honorifics (Dott., Ing., etc.)
  • Contact Details - Email, PEC, phone numbers in Italian format
  • Modular Design - Use just what you need
  • Async Support - All methods support both Promise and Observable patterns

🚀 Quick Start

npm i @italia-tools/faker

💫 Create a Complete Italian Person

Using Promises

import { ItFaker } from '@italia-tools/faker';

const itFaker = new ItFaker();

// Using Promise
await itFaker.itPerson.generatePerson()
  .then(person => {
    console.log(person);
    // {
    //   "fullName": "Marco Rossi",
    //   "firstName": "Marco",
    //   "lastName": "Rossi",
    //   "gender": "male",
    //   "birthDate": "1947-05-10T02:38:15.257Z",
    //   "birthPlace": {
    //     "city": "Milano",
    //     "province": "Milano",
    //     "region": "Lombardia"
    //   },
    //   "fiscalCode": "RSSMRC85L15F205X",
    //   "contacts": {
    //     "phone": "3681961744",
    //     "email": "[email protected]",
    //     "pec": "[email protected]"
    //   },
    //   "address": "Via Garibaldi, 118 Scala D, Piano 2, 00100 Roma (RM)"
    // }
  });

// Or using async/await
const person = await itFaker.itPerson.generatePerson();

Using Observables

import { ItFaker } from '@italia-tools/faker';

const itFaker = new ItFaker();

// Using Observable
itFaker.itPerson.generatePerson$().subscribe(person => {
  console.log(person);
});

🎯 Specific Generation

// Generate with specific options (Promise)
const person = await itFaker.itPerson.generatePerson({
  gender: 'male',
  region: 'Lombardia',
  minAge: 25,
  maxAge: 35,
  withTitle: true
});

// Or using Observable
itFaker.itPerson.generatePerson$({
  gender: 'male',
  region: 'Lombardia',
  minAge: 25,
  maxAge: 35,
  withTitle: true
}).subscribe(person => console.log(person));

// Just need a name? (Promise)
const name = await itFaker.itPerson.fullName({ gender: 'male', prefix: true });
// "Prof. Giuseppe Bianchi"

// Professional email? (Observable)
itFaker.itPerson.email$('Mario', 'Verdi')
  .subscribe(email => console.log(email));  // "[email protected]"

// Need a PEC address? (Promise)
const pec = await itFaker.itPerson.pec('Mario', 'Verdi');  
// "[email protected]"

// Italian mobile number? (Observable)
itFaker.itPerson.phone$()
  .subscribe(phone => console.log(phone));  // "3281234567"

// Landline number? (Promise)
const landline = await itFaker.itPerson.landline();  
// "021234567"

🏛 Geographic Data

// Get a random Italian city (Promise)
const birthPlace = await itFaker.itPerson.birthPlace();  
// "Milano"

// Get province info (Observable)
itFaker.itPerson.province$()
  .subscribe(province => console.log(province));
// { name: "Milano", code: "MI" }

🛠 Advanced Options

// Using Promise
const businessPerson = await itFaker.itPerson.generatePerson({
  gender: 'female',
  region: 'Lazio',
  province: 'RM',
  withTitle: true,  // Includes professional title
  minAge: 30,
  maxAge: 65
});

// Using Observable
itFaker.itPerson.generatePerson$({
  gender: 'female',
  region: 'Lazio',
  province: 'RM',
  withTitle: true,
  minAge: 30,
  maxAge: 65
}).subscribe(businessPerson => console.log(businessPerson));

🎯 Use Cases

  • Testing Italian-specific applications
  • Generating realistic test data
  • UI/UX prototyping
  • Database seeding
  • Demo environments

📊 Data Sources

  • Real ISTAT demographic data
  • Actual Italian administrative codes
  • Authentic geographic distributions
  • Valid fiscal code algorithms

📖 Documentation

Visit our detailed documentation for complete API reference.

🤝 Contributing

Contributions are welcome!

📄 License

MIT © Dawit


Made with ❤️ for the Italian developer community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published