Node.js faker.js dummy data generation

Generating Dummy Data with faker.js in Node.js

This article introduces how to generate dummy data and fake data for testing using the faker.js library in the Node.js programming language. For example, it generates random colors, animal names, people's names, lorem ipsum, etc.

Shou Arisaka
1 min read
Oct 16, 2025

This article introduces how to generate dummy data and fake data for testing using the faker.js library in the Node.js programming language. For example, it generates random colors, animal names, people’s names, lorem ipsum, etc.

Marak/faker.js: generate massive amounts of realistic fake data in Node.js and the browser

Random colors

faker.commerce.color()
'black'
faker.commerce.color()
'pink'
faker.commerce.color()
'turquoise'

Lorem Ipsum Slugs

faker.lorem.slug()
'et-dicta-quo'
faker.lorem.slug()
'quos-ut-tempore'
faker.lorem.slug()
'laborum-sit-maiores'

Lorem Ipsum (Longer) In foreign countries, this is sometimes used for fake blog posts or dummy articles for web design portfolios.

faker.lorem.slug(12)
'ducimus-saepe-hic-molestias-nesciunt-laudantium-rerum-repellendus-nisi-possimus-enim-ea'
faker.lorem.slug(12)
'at-est-ducimus-id-a-quod-maiores-sint-rerum-aut-dolores-suscipit'
faker.lorem.slug(12)
'molestiae-voluptatum-quia-necessitatibus-officiis-fugit-amet-blanditiis-rerum-sequi-velit-voluptas'

Heroku Subdomain Style I’m replacing spaces because sometimes “mint green” etc. comes in.

`${faker.commerce.color().replace(/ /g, '')}-${faker.animal.type()}-${faker.datatype.number()}`
'mintgreen-cow-90337'
`${faker.commerce.color().replace(/ /g, '')}-${faker.animal.type()}-${faker.datatype.number()}`
'silver-fish-48228'
`${faker.commerce.color().replace(/ /g, '')}-${faker.animal.type()}-${faker.datatype.number()}`
'plum-fish-87861' 

The overall node.js program looks like this:

const faker = require('faker');

console.log(
`${faker.commerce.color().replace(/ /g, '')}-${faker.animal.type()}-${faker.datatype.number()}`
);

Share this article

Shou Arisaka Oct 16, 2025

🔗 Copy Links