All Projects → faker-js → faker

faker-js / faker

Licence: other
Generate massive amounts of fake data in the browser and node.js

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to faker

FakerDotNet
A .NET port of the Ruby faker gem
Stars: ✭ 15 (-99.78%)
Mutual labels:  fake, faker
Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (-50.45%)
Mutual labels:  fake, faker
Faker.NET.Portable
C# port of the Ruby Faker gem (http://faker.rubyforge.org/)
Stars: ✭ 22 (-99.68%)
Mutual labels:  fake, faker
faker-buzzword-job-titles
👔 A job title generator for faker based on Buzzwords.
Stars: ✭ 14 (-99.8%)
Mutual labels:  fake, faker
Faker
A library for Dart that generates fake data.
Stars: ✭ 103 (-98.52%)
Mutual labels:  fake, faker
Mockaco
🐵 HTTP mock server, useful to stub services and simulate dynamic API responses, leveraging ASP.NET Core features, built-in fake data generation and pure C# scripting
Stars: ✭ 213 (-96.93%)
Mutual labels:  fake, faker
minifaker
A lightweight alternative to faker.js
Stars: ✭ 64 (-99.08%)
Mutual labels:  fake, faker
random
Random data generator AKA faker
Stars: ✭ 14 (-99.8%)
Mutual labels:  fake, faker
Fakerator
Random fake data generator with localization for Javascript in Node.js and browser
Stars: ✭ 91 (-98.69%)
Mutual labels:  fake, faker
Faker.js
generate massive amounts of realistic fake data in Node.js and the browser
Stars: ✭ 34,329 (+394.65%)
Mutual labels:  fake, faker
Bogus
📇 A simple and sane fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Stars: ✭ 5,083 (-26.76%)
Mutual labels:  fake, faker
Joal
An open source command line RatioMaster with an optional WebUI.
Stars: ✭ 213 (-96.93%)
Mutual labels:  fake, faker
Fake Apache Log Generator
Generate a boatload of Fake Apache Log files very quickly
Stars: ✭ 207 (-97.02%)
Mutual labels:  fake, faker
mkjson
A commandline tool to generate static or random JSON records
Stars: ✭ 16 (-99.77%)
Mutual labels:  fake, faker
fake-numbers
Generate fake, valid numbers. Check if a number is valid. Support a lot of different numbers: Credit card, EAN, ISBN, RTN, VIN, etc.
Stars: ✭ 51 (-99.27%)
Mutual labels:  faker
apollobank
A full stack GraphQL banking application using React, Node & TypeScript.
Stars: ✭ 203 (-97.07%)
Mutual labels:  faker
ImNotSpider
浏览器User Agent生成器
Stars: ✭ 17 (-99.76%)
Mutual labels:  faker
bypass
↪️ Bypass for PHP creates a custom HTTP Server to return predefined responses to client requests. Useful for tests with Pest PHP or PHPUnit.
Stars: ✭ 98 (-98.59%)
Mutual labels:  faker
moq.ts
Moq for Typescript
Stars: ✭ 107 (-98.46%)
Mutual labels:  fake
useragent-generator
Easily generate correct user-agent strings for popular browsers
Stars: ✭ 62 (-99.11%)
Mutual labels:  fake

Faker

Generate massive amounts of fake (but realistic) data for testing and development.

npm version npm downloads Continuous Integration codecov Chat on Discord Open Collective sponsor

⚡️ Try it Online

API Documentation

🚀 Features

  • 💌 Addresses - Generate valid looking Addresses, Zip Codes, Street Names, States, and Countries!
  • Time-based Data - Past, present, future, recent, soon... whenever!
  • 🌏 Localization - Set a locale to generate realistic looking Names, Addresses, and Phone Numbers.
  • 💸 Finance - Create stubbed out Account Details, Transactions, and Crypto Addresses.
  • 👠 Products - Generate Prices, Product Names, Adjectives, and Descriptions.
  • 👾 Hacker Jargon - “Try to reboot the SQL bus, maybe it will bypass the virtual application!”
  • 🧍 Names - Generate virtual humans with a complete online and offline identity.
  • 🔢 Numbers - Of course, we can also generate random numbers and strings.

Note: Faker tries to generate realistic data and not obvious fake data. The generated names, addresses, emails, phone numbers, and/or other data might be coincidentally valid information. Please do not send any of your messages/calls to them from your test setup.

📦 Install

npm install --save-dev @faker-js/faker

🪄 Usage

import { faker } from '@faker-js/faker';
// import { faker } from '@faker-js/faker/locale/de';

export const USERS: User[] = [];

export function createRandomUser(): User {
  return {
    userId: faker.datatype.uuid(),
    username: faker.internet.userName(),
    email: faker.internet.email(),
    avatar: faker.image.avatar(),
    password: faker.internet.password(),
    birthdate: faker.date.birthdate(),
    registeredAt: faker.date.past(),
  };
}

Array.from({ length: 10 }).forEach(() => {
  USERS.push(createRandomUser());
});

💎 Modules

An in-depth overview of the API methods is available in the documentation.
The API covers the following modules:

Module Example Output
Address faker.address.city() Lake Raoulfort
Animal faker.animal.cat() Norwegian Forest Cat
Color faker.color.rgb() #cdfcdc
Commerce faker.commerce.product() Polo t-shirt
Company faker.company.companyName() Zboncak and Sons
Database faker.database.engine() MyISAM
Datatype faker.datatype.uuid() 7b16dd12-935e-4acc-8381-b1e457bf0176
Date faker.date.past() Sat Oct 20 2018 04:19:38 GMT-0700 (Pacific Daylight Time)
Finance faker.finance.amount() ¥23400 (After setting locale)
Git faker.git.commitMessage() feat: add products list page
Hacker faker.hacker.phrase() Try to reboot the SQL bus, maybe it will bypass the virtual application!
Helpers faker.helpers.arrayElement(['a', 'b', 'c']) b
Image faker.image.cats() https://loremflickr.com/640/480/cats
Internet faker.internet.domainName() muddy-neuropathologist.net
Lorem faker.lorem.paragraph() Porro nulla id vero perspiciatis nulla nihil. ...
Music faker.music.genre() R&B
Name faker.name.firstName() Cameron
Phone faker.phone.phoneNumber() +1 291-299-0192
Random faker.random.locale() fr_CA
Science faker.science.unit() { name: 'meter', symbol: 'm' }
System faker.system.directoryPath() /root
Vehicle faker.vehicle.vehicle() Lamborghini Camry
Word faker.word.adjective() adorable

Templates

Faker contains a generator method faker.helpers.fake for combining faker API methods using a mustache string format.

console.log(
  faker.helpers.fake(
    'Hello {{name.prefix}} {{name.lastName}}, how are you today?'
  )
);

🌏 Localization

Faker has support for multiple locales.

The default language locale is set to English.

Setting a new locale is simple:

// sets locale to de
faker.locale = 'de';

See our documentation for a list of provided languages

Please note that not every locale provides data for every module. In out pre-made locales, we fallback to english in such a case as this is the most complete and most common used language.

⚙️ Setting a randomness seed

If you want consistent results, you can set your own seed:

faker.seed(123);

const firstRandom = faker.datatype.number();

// Setting the seed again resets the sequence.
faker.seed(123);

const secondRandom = faker.datatype.number();

console.log(firstRandom === secondRandom);

🤝 Sponsors

Faker is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome backers

Sponsors

Backers

Contributing

Please make sure to read the Contributing Guide before making a pull request.

📘 Credits

Thanks to all the people who already contributed to Faker!

The fakerjs.dev website is kindly hosted by the Netlify Team. Also the search functionality is powered by algolia.

📝 Changelog

Detailed changes for each release are documented in the release notes.

📜 What happened to the original faker.js?

Read the team update (January 14th, 2022).

🔑 License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].