Faker
Generate massive amounts of fake (but realistic) data for testing and development.
[](https://chat.fakerjs.dev)
[](https://github.com/faker-js/faker/actions/workflows/ci.yml)
[](https://codecov.io/gh/faker-js/faker)
[](https://www.npmjs.com/package/@faker-js/faker)
[](https://www.npmjs.com/package/@faker-js/faker)
[](https://opencollective.com/fakerjs#section-contributors)
[](https://opencollective.com/fakerjs)
### Try it Online ⚡️
[fakerjs.dev/new](https://fakerjs.dev/new)
[](https://fakerjs.dev/new)
## Installation
Please replace your `faker` dependency with `@faker-js/faker`. This is the official, stable fork of Faker.
```shell
npm install @faker-js/faker --save-dev
```
or yarn
```shell
yarn add @faker-js/faker -D
```
or pnpm
```shell
pnpm install @faker-js/faker -D
```
### Browser
```html
```
### Node.js
```js
const { faker } = require('@faker-js/faker');
const randomName = faker.name.findName(); // Rowan Nikolaus
const randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz
const randomCard = faker.helpers.createCard(); // random contact card containing many properties
```
### Deno
```js
import { faker } from 'https://cdn.skypack.dev/@faker-js/faker';
const randomName = faker.name.findName(); // Willie Bahringer
const randomEmail = faker.internet.email(); // Tomasa_Ferry14@hotmail.com
const randomCard = faker.helpers.createCard(); // random contact card containing many properties
```
### TypeScript Support
Since version `v6+` there is native TypeScript support.
If you want for whatever reason the versions prior to `v6`,
you can use `@types/faker` and rebind the declarations to the `@faker-js/faker` package with a `faker.d.ts` file in your e.g. src folder.
```ts
// faker.d.ts
declare module '@faker-js/faker' {
import faker from 'faker';
export default faker;
}
```
## API
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.type()` | Dog, cat, snake, bear, lion, etc. |
| Commerce | `faker.commerce.product()` | Polo t-shirt |
| Company | `faker.company.companyName()` | Zboncak and Sons |
| Database | `faker.database.engine()` | MyISAM |
| Datatype | `faker.datatype.uuid()` | 1oijf8-3iuhiu-21jddj-1092jf |
| 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.userCard()` | `{ avatar: '...', email: '{ first }{ last }{ number }@{domain}', first: '...' }`