ランキングに戻る

faker-js/faker

TypeScriptfakerjs.dev

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

fakerdatafakenodejsbrowserjavascripttypescript
スター成長
スター
15.4k
フォーク
1.1k
週間成長
Issue
93
5k10k15k
2022年1月2023年7月2025年1月2026年7月
成果物npmnpm install faker
README

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

Open in StackBlitz

📙 API Documentation

⚠️ You are reading the docs for the next branch ⚠️

Please proceed to the Getting Started Guide for the stable release of Faker.

For detailed API documentation, please select the version of the documentation you are looking for.

Version Website
v10 (next) https://next.fakerjs.dev/
v10 (stable) https://fakerjs.dev/
v9 (old) https://v9.fakerjs.dev/

🚀 Features

  • 🧍 Person - Generate Names, Genders, Bios, Job titles, and more.
  • 📍 Location - Generate Addresses, Zip Codes, Street Names, States, and Countries!
  • ⏰ Date - Past, present, future, recent, soon... whenever!
  • 💸 Finance - Create stubbed out Account Details, Transactions, and Crypto Addresses.
  • 👠 Commerce - Generate Prices, Product Names, Adjectives, and Descriptions.
  • 👾 Hacker - “Try to reboot the SQL bus, maybe it will bypass the virtual application!”
  • 🔢 Number and String - Of course, we can also generate random numbers and strings.
  • 🌏 Localization - Pick from over 70 locales to generate realistic looking Names, Addresses, and Phone Numbers.

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

// ESM
import { faker } from '@faker-js/faker';

// CJS
const { faker } = require('@faker-js/faker');

export function createRandomUser() {
  return {
    userId: faker.string.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(),
  };
}

export const users = faker.helpers.multiple(createRandomUser, {
  count: 5,
});

💎 Modules

An in-depth overview of the API methods is available in the documentation for v10 (stable) and v10.* (next).

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 {{person.prefix}} {{person.lastName}}, how are you today?'
  )
);

🌏 Localization

Faker has support for multiple locales.

The main faker instance uses the English locale. But you can also import instances using other locales.

// ESM
import { fakerDE as faker } from '@faker-js/faker';

// CJS
const { fakerDE: faker } = require('@faker-js/faker');

See our documentation for a list of provided languages.

Please note: Not every locale provides data for every module. In our pre-made faker instances, we fall back to English in such a case as this is the most complete and most commonly used language. If you don't want that or prefer a different fallback, you can also build your own instances.

import { de, de_CH, Faker } from '@faker-js/faker';

export const faker = new Faker({
  locale: [de_CH, de],
});

⚙️ Setting a randomness seed

If you want consistent results, you can set your own seed. If you are using faker.date methods, there are additional considerations. See Reproducible Results.

faker.seed(123);

const firstRandom = faker.number.int();

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

const secondRandom = faker.number.int();

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 generously hosted by Netlify, with search functionality 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

関連リポジトリ
joke2k/faker

Faker is a Python package that generates fake data for you.

PythonPyPIMIT Licensepythonfake
faker.readthedocs.io
19.3k2.1k
bchavez/Bogus

:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.

C#Otherfakedata
9.7k542
orval-labs/orval

orval is able to generate client with appropriate type-signatures (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification, either in yaml or json formats. 🍺

TypeScriptnpmMIT Licenseorvalaxios-client
orval.dev
6.3k648
dubzzz/fast-check

Property based testing framework for JavaScript (like QuickCheck) written in TypeScript

TypeScriptnpmMIT Licenseproperty-based-testingquickcheck
fast-check.dev
5.1k209
nucleuscloud/neosync

Open Source Data Security Platform for Developers to Monitor and Detect PII, Anonymize Production Data and Sync it across environments.

GoGo ModulesOtherdockergolang
neosync.dev
4.1k235
fake-useragent/fake-useragent

Up-to-date simple useragent faker with real world database

PythonPyPIApache License 2.0pythonpython3
pypi.python.org/pypi/fake-useragent
4.1k538
boo1ean/casual

Fake data generator for javascript

JavaScriptnpmjavascriptfaker
3k150
APIs-guru/graphql-faker

🎲 Mock or extend your GraphQL API with faked data. No coding required.

TypeScriptnpmMIT Licensegraphqlidl
2.7k229
graphql-kit/graphql-faker

🎲 Mock or extend your GraphQL API with faked data. No coding required.

TypeScriptnpmMIT Licensegraphqlidl
2.7k226
nelmio/alice

Expressive fixtures generator

PHPPackagistMIT Licensephpfaker
2.5k329
emirozer/fake2db

create custom test databases that are populated with fake data

PythonPyPIGNU General Public License v2.0fake-contentfaker
2.4k121
bxcodec/faker

Go (Golang) Fake Data Generator for Struct. [Notes]This repository is archived, moved to the new repository https://github.com/go-faker/faker

GoGo ModulesMIT Licensegeneratorfaker
pkg.go.dev/github.com/bxcodec/faker/v4
2.1k145