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

moroccan-faker

v1.0.0

Published

Generate realistic Moroccan fake data for testing applications - names, addresses, phone numbers, CIN, and more

Readme

🇲🇦 Moroccan Faker

Generate realistic Moroccan fake data for testing applications.

npm version License: MIT

Installation

npm install moroccan-faker

Quick Start

const moroccanFaker = require('moroccan-faker');

// Generate a complete person
const person = moroccanFaker.generatePerson();
console.log(person);
// {
//   nom: "Bennani",
//   prenom: "Mehdi",
//   cin: "AB123456",
//   telephone: "0612345678",
//   dateNaissance: "1995-03-15",
//   adresse: {
//     numero: 45,
//     rue: "Avenue Hassan II",
//     quartier: "Maarif",
//     ville: "Casablanca",
//     codePostal: "20100"
//   }
// }

// Generate just an address
const address = moroccanFaker.generateAddress();

// Generate a phone number
const phone = moroccanFaker.generatePhone();

// Validate Moroccan CIN
const isValid = moroccanFaker.validateCIN("AB123456");

API Reference

Generators

generatePerson(options)

Generate a complete person with all details.

Options:

  • genre: 'masculin' or 'feminin' (optional)
  • ville: Force a specific city (optional)
  • age: { min: number, max: number } (optional)
const person = moroccanFaker.generatePerson({
  genre: 'feminin',
  ville: 'Marrakech',
  age: { min: 25, max: 35 }
});

generateAddress(ville)

Generate a Moroccan address.

const address = moroccanFaker.generateAddress('Rabat');

generatePhone()

Generate a valid Moroccan phone number.

const phone = moroccanFaker.generatePhone();
// Returns: "0612345678"

generateCIN()

Generate a valid Moroccan CIN (Carte d'Identité Nationale).

const cin = moroccanFaker.generateCIN();
// Returns: "AB123456"

Validators

validateCIN(cin)

Validate a Moroccan CIN format.

moroccanFaker.validateCIN("AB123456"); // true
moroccanFaker.validateCIN("INVALID"); // false

validatePhone(phone)

Validate a Moroccan phone number.

moroccanFaker.validatePhone("0612345678"); // true
moroccanFaker.validatePhone("1234567890"); // false

validatePostalCode(code, ville)

Validate a postal code for a specific city.

moroccanFaker.validatePostalCode("20000", "Casablanca"); // true

Use Cases

Testing

describe('User Registration', () => {
  it('should register a user with valid Moroccan data', () => {
    const testUser = moroccanFaker.generatePerson();
    // Use testUser in your tests
  });
});

Database Seeding

const users = [];
for (let i = 0; i < 100; i++) {
  users.push(moroccanFaker.generatePerson());
}
// Insert users into database

Prototyping

// Quickly populate your app with realistic data
const mockUsers = Array(50).fill(null).map(() => 
  moroccanFaker.generatePerson()
);

Available Data

  • 100+ Moroccan first names (male & female)
  • 150+ Moroccan family names
  • 20+ Major Moroccan cities
  • 50+ Street names
  • 40+ Neighborhoods
  • Valid CIN format
  • Valid Moroccan phone numbers (06XX, 07XX, 05XX)
  • Real postal codes

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Add more data

You can help by adding more:

  • First names
  • Family names
  • Cities
  • Street names
  • Neighborhoods

See CONTRIBUTING.md for details.

License

MIT © [mouadcherkaouielmalki-jpg]

Links

Support

If you find this package useful, please give it a star on GitHub!