faker README

The project's README from github.com/faker-js/faker. As one markdown file: README.md.

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
v11 (next) https://next.fakerjs.dev/
v10 (stable) https://fakerjs.dev/
v9 (old) https://v9.fakerjs.dev/

🚀 Features

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 v11 (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

faker (faker-js/faker)

Searching Database…

15.5K ·GitHub
What is this?Faker is a JavaScript/TypeScript library that generates massive amounts of fake but realistic data — names, addresses, dates, finance records — for testing and development, in the browser and Node.js.
Is it a library I import into my own code, or an online service?A library: you install it from npm and call its generator methods directly in your JavaScript or TypeScript code. There is also a StackBlitz playground if you want to try it without installing anything.
How do I add it to a project?Install the @faker-js/faker package from npm (usually as a dev dependency) and import the faker instance. Docs live on fakerjs.dev; v10 is the stable release and v11 is next.
Does my environment need anything specific to run it?Node.js ^22.13.0, ^23.5.0 or >=24 with npm 10 or newer. The package ships with zero runtime dependencies, so it adds nothing else to your dependency tree.
Is the data it generates guaranteed to be obviously fake?No — Faker intentionally produces realistic-looking data, so generated names, addresses, emails and phone numbers might coincidentally belong to real people. The README warns not to send them messages or calls from your test setup.
Can I use it in commercial projects for free?Yes — Faker is MIT-licensed open source, with ongoing development funded by sponsors and backers.
What kinds of data can it generate?Person data (names, genders, bios, job titles), locations (addresses, zip codes, street names, states, countries), dates (past, present, future, recent, soon), finance (account details, transactions, crypto addresses), commerce (prices, product names, adjectives, descriptions), joke 'hacker' phrases, plus random numbers and strings.
Can it generate data in other languages?Yes — over 70 locales. The main instance uses English; you import a locale-specific instance for other languages. Not every locale covers every module, and pre-made instances fall back to English where data is missing, but you can build your own instances with a different fallback.
Can I get the same 'random' data on every run?Yes — set your own randomness seed and results become consistent and reproducible. The README notes there are additional considerations when seeding faker.date methods.
What happened to the original faker.js?The README points to a team update from January 14th, 2022 explaining it. The project now continues under the faker-js organization, with docs, release notes and a changelog on fakerjs.dev.
Creator
faker-js
Size
32.6 MB
Stars
15.5K
Age
4y
Commits · 90 Days