Need A Lot Of Fake Data, Real Quick?

Say no more, for faker.js has you covered!

faker.js is fake data generator for nodejs and the browser. From zip codes to avatars to account names to hacker phrases, faker.js comes equiped with a huge dataset.



Just link to faker.js in your html through their CDN :

<script src=””></script>

Or to your local download:

<script src=”/path/to/faker.js”></script>

…And you’re set!


Install the dependency into your directory:

npm install faker

Then create an index.js and inside require faker:

var faker = require(‘faker’);

…And now you have access to faker.js!

API Service

faker.js even has a hosted API you can request random data from. Heres how you could fetch data using ajax:

 url: "" + METHOD, 
 type: "GET", 
 contentType: "json", 
 success: function(data) { console.log(data); } 

and using curl:


How To Use

Once you have faker.js installed, you will have access to the faker object. This object is filled with subcategories of data (address, company, database, date, hacker, image, internet, name, phone, random…).

Each subcategory has a set of methods that, when called, will return some data based on method called.


Input (nodejs)

…And again…

You can even change the localization by changing faker.locale! (the default is english)

faker.local = “fr”; // language is set to French

faker.local = "es"; // language is set to Spanish


Receiving from the API is just as easy!

Ajax example:

ajax output

Curl Example:


Additional Features

You can seed results by using faker.seed.

You can use faker.fake for combining different methods.

Show your support

Clapping shows how much you appreciated Cain W’s story.