Mock data generator

API docs

API documentation

Our web application provides an API that allows you to generate sample data using `faker`, an npm library. This makes it easy to quickly create test records, mocks, or prototype data without having to build them by hand.

Example code to fetch API

Basic API fetch code
1
2
3
4
5
6
7
8
9
10
const res = await fetch("https://mock-data-generator-jet.vercel.app/api/generator", {  method: "POST",  body: JSON.stringify({    count: 10,    fields: ["firstName", "lastName"],  })});const data = await res.json();console.log(data.value);

In console you should see:

Result
[  { firstName: 'Estelle', lastName: 'Turcotte' },  { firstName: 'Shaun', lastName: 'Wilkinson' },  { firstName: 'Archie', lastName: 'Russel' },  { firstName: 'Ruben', lastName: 'Emard' },  { firstName: 'Barbara', lastName: 'Hahn' },  { firstName: 'Nikki', lastName: 'Okuneva' },  { firstName: 'Johnnie', lastName: 'Howe' },  { firstName: 'Molly', lastName: 'Runolfsson' },  { firstName: 'Sherman', lastName: 'Schowalter' },  { firstName: 'Earl', lastName: 'Klein' }]
Note
Values in your console can be a bit different because seed is not set and data is generated randomly.

You can change count of records, fields and seed:

Seed API fetch code
1
2
3
4
5
6
7
8
9
10
11
const res = await fetch("https://mock-data-generator-jet.vercel.app/api/generator", {  method: "POST",  body: JSON.stringify({    count: 5,    fields: ["avatar", "email", "password"],    seed: 123,  })});const data = await res.json();console.log(data.value);

In console you will get:

Result
[  {    avatar: 'https://avatars.githubusercontent.com/u/28613933',    email: 'Chris84@gmail.com',    password: 'aqi83WueYU0cbUE'  },  {    avatar: 'https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/male/512/71.jpg',    email: 'Gabriel.Murray@hotmail.com',    password: 'xpBFcBiYbF7AQ_q'  },  {    avatar: 'https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/male/512/68.jpg',    email: 'Jeannie_Kuvalis11@hotmail.com',    password: 'UrEB1oAUWRw4Rv9'  },  {    avatar: 'https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/34.jpg',    email: 'Jeffrey.Moore@hotmail.com',    password: 'VmFf0ZsI4KUyWLh'  },  {    avatar: 'https://avatars.githubusercontent.com/u/43857224',    email: 'Jasmine_Langosh@hotmail.com',    password: 'gdp0kucJJiVXnAy'  }]
Info
  • Count can be between 1 and 300.
  • You can use as many fields as you need.
  • Seed is optional, if you don't set it, data will be generated randomly.

All working fields

Column nameColumn value
"firstName"First name of user like "John"
"lastName"Last name of user like "Doe"
"fullName"Full name of user like "John Doe"
"email"Email of user like "john.doe@example.com"
"username"Username of user like "john_doe"
"password"Password of user like "password123"
"avatar"Avatar of user like "https://example.com/avatar.png"
"phrase"Phrase of user with computer science terms
"anytime"Random date and time