@faker-js/faker
Faker is a library for generating massive amounts of realistic fake data for testing, development, and demonstration purposes. The community-maintained @faker-j…
Installation
npm install -D @faker-js/faker
yarn add -D @faker-js/faker
pnpm add -D @faker-js/faker
Import
import { faker } from '@faker-js/faker';Quick Example
import { faker } from '@faker-js/faker';
const user = {
name: faker.person.fullName(),
email: faker.internet.email(),
avatar: faker.image.avatar(),
address: faker.location.streetAddress(),
};
console.log(user);About @faker-js/faker
Faker is a library for generating massive amounts of realistic fake data for testing, development, and demonstration purposes. The community-maintained @faker-js/faker package (forked from the original faker.js after its controversial deletion) provides generators for names, addresses, phone numbers, emails, dates, commerce data, company information, finance details, images, lorem ipsum text, and dozens of other data categories. Faker supports locale-specific data generation for over 60 locales, producing culturally appropriate names, addresses, and phone number formats. The library provides both simple generators (faker.person.firstName()) and complex builders for creating realistic interconnected data objects. Faker includes a seeding system that produces deterministic output, allowing reproducible test data generation across test runs. Common use cases include populating development databases with realistic sample data, generating test fixtures for unit tests, creating demonstration data for prototypes and screenshots, and stress testing applications with large volumes of varied data. Faker integrates well with factory patterns and ORM seeders for generating complete object graphs with realistic relationships.
Quick Facts
| Package | @faker-js/faker |
| Category | Testing |
| Weekly Downloads | 5M+ |
| License | MIT |
| Install | npm install -D @faker-js/faker |
Related Packages
Jest is a delightful JavaScript testing framework with a focus on simplicity, created by Facebook. I…
Vitest is a blazing-fast unit testing framework powered by Vite, designed as a modern alternative to…
Mocha is a feature-rich JavaScript test framework that runs on Node.js and in the browser, providing…
Mock Service Worker (MSW) is an API mocking library that uses the Service Worker API to intercept re…
Sinon.js provides standalone test spies, stubs, and mocks for JavaScript that work with any test fra…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.