How to Generate fake data using Faker module in Node.js ? Last Updated : 16 Aug, 2021 Comments Improve Suggest changes Like Article Like Report Faker module is used to generate fake data, not only fake data, infect well organized fake data. Faker module is a widely used NPM module that can generate fake names, addresses, product names, prices with all these you can also generate fake IP addresses, images, and much more using this faker package.Command to install faker module:  npm install faker There are some predefined context for which fake data are created for a particular context as mentioned below: Context(object)Aspect(method)namefirstName, lastName, findName, suffix, jobTitle, jobDiscriptoraddresslatitude, longitude, country, state, city, zipCode, streetNamecommerceproduct, productName, price, productMaterialfinanceaccount, accountName, amount, currencyName, currencyCode, transactionTypeimagepeople, nature, sports, animals, fashion, food, nightLifeinternetemail, url, ip, mac, password, domainName Syntax to get fake data  faker.context.aspect() Example 1:  javascript // Program to generate some fake // names with their job titles // Requiring faker module const faker = require('faker') for(let i=0; i<8; i++){ // Fake first name const firstName = faker.name.firstName() // Fake last name const lastName = faker.name.lastName() // Fake suffix const suffix = faker.name.suffix() // Fake job Title const jobTitle = faker.name.jobTitle() console.log(`${suffix} ${firstName} ${lastName} works as '${jobTitle}'`) } Output:  Example 2:  javascript // Program to generate some fake // products with their details // Requiring faker module const faker = require('faker') for (let i = 0; i < 8; i++) { // Fake product name const product = faker.commerce.product() // fake price of that product const price = faker.commerce.price() // Fake details const productMaterial = faker.commerce.productMaterial() console.log(`${product} made with ${productMaterial}, price ${price}$`) } Output:  Example 3:  javascript // Program to generate some fake // bank transaction details // Requiring faker module const faker = require('faker') for (let i = 0; i < 8; i++) { // Fake account type const ac = faker.finance.account() // Fake account name const acName = faker.finance.accountName() // Fake transaction type const tT = faker.finance.transactionType() // Fake amount transaction const amt = faker.finance.amount() console.log(`${acName}, Account No-${ac}, transaction Type-${tT}, Amount-${amt}`) } Output:  Example 4:  javascript // Program to generate some fake // domain name and ip addresses // Requiring faker module const faker = require('faker') for (let i = 0; i < 8; i++) { // Fake ip address const ip = faker.internet.ip() // Fake domain name const domainName = faker.internet.domainName() console.log(`Domain name -> ${domainName}, ip-address-> ${ip}`) } Output:  Reference: NPM faker package Comment More infoAdvertise with us Next Article How to Generate fake data using Faker module in Node.js ? H hunter__js Follow Improve Article Tags : Web Technologies Node.js Node.js-Misc Similar Reads Generating Errors using HTTP-errors module in Node.js HTTP-errors module is used for generating errors for Node.js applications. It is very easy to use. We can use it with the express, Koa, etc. applications. We will implement this module in an express application. Installation and Setup: First, initialize the application with the package.json file wit 2 min read How to Add Data in JSON File using Node.js ? JSON stands for Javascript Object Notation. It is one of the easiest ways to exchange information between applications and is generally used by websites/APIs to communicate. For getting started with Node.js, refer this article.Prerequisites:NPM NodeApproachTo add data in JSON file using the node js 4 min read How to Validate Data using joi Module in Node.js ? Joi module is a popular module for data validation. This module validates the data based on schemas. There are various functions like optional(), required(), min(), max(), etc which make it easy to use and a user-friendly module for validating the data. Introduction to joi It's easy to get started a 3 min read How to Validate Data using express-validator Module in Node.js ? Validation in node.js can be easily done by using the express-validator module. This module is popular for data validation. There are other modules available in market like hapi/joi, etc but express-validator is widely used and popular among them.Steps to install express-validator module:  You can 3 min read How to add new functionalities to a module in Node.js ? Node.js is an open-source and cross-platform runtime environment built on Chromeâs V8 JavaScript engine for executing JavaScript code outside of a browser. You need to recollect that NodeJS isnât a framework, and itâs not a programming language. In this article, we will discuss how to add new functi 3 min read Like