
Security News
The Next Open Source Security Race: Triage at Machine Speed
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.
@faker-js/faker
Advanced tools
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.
npm install --save-dev @faker-js/faker
// 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,
});
An in-depth overview of the API methods is available in the documentation for v10 (stable) and v10.* (next).
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?'
)
);
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],
});
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);
Faker is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome backers
Please make sure to read the Contributing Guide before making a pull request.
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.
Detailed changes for each release are documented in the release notes.
Read the team update (January 14th, 2022).
Chance is a minimalist generator of random strings, numbers, etc. to help reduce some monotony particularly while writing automated tests or anywhere else you need anything random.
Casual is a fake data generator for JavaScript which is more lightweight than @faker-js/faker and provides an easy-to-use API with a smaller set of functionalities.
Randexp generates strings that match a given regular expression which is useful for creating random data that fits a specific pattern, unlike @faker-js/faker which provides a wide range of predefined data types.
FAQs
Generate massive amounts of fake contextual data
The npm package @faker-js/faker receives a total of 11,352,049 weekly downloads. As such, @faker-js/faker popularity was classified as popular.
We found that @faker-js/faker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.