Introducing csv-faker-generator: Generate Realistic Test Data in Seconds

Introducing csv-faker-generator: Generate Realistic Test Data in Seconds

posted Originally published at www.manojkengudelu.com 3 min read

Photo courtesy of Pexels

TL;DR: I just published csv-faker-generator, a TypeScript CLI tool that generates CSV files with realistic fake data. Perfect for testing, prototyping, and development. Install it with npm install csv-faker-generator.

The Problem

How many times have you needed test data for your application? Whether you're building a data pipeline, testing import functionality, or prototyping a feature, you inevitably need realistic-looking CSV files with hundreds or thousands of rows.
You have a few options:

  1. Manually create sample data — tedious and limited
  2. Use existing faker libraries — great, but requires writing boilerplate code
  3. Export production data — risky and time-consuming
  4. Use a generic CSV generator — inflexible and often outdated

None of these felt ideal. I found myself repeatedly writing the same wrapper code around @faker-js/faker and csv-writer just to generate test datasets. That's when I decided to build csv-faker-generator.

The Solution

csv-faker-generator is a lightweight, open-source npm package that makes generating fake CSV data as simple as running a single command.

Features

  • 19+ data types — UUID, names, emails, addresses, phone numbers, dates, and more
  • CLI & Programmatic API — Use it from the command line or integrate it into your Node.js/TypeScript projects
  • Full TypeScript support — Complete type definitions included
  • Customizable output — Define your own columns and data types
  • Fast & efficient — Generate thousands of rows in milliseconds

Getting Started

Installation

npm install csv-faker-generator
or use it globally
npx csv-faker-generator

CLI Usage

The simplest way to generate a CSV file is through the command line:

Generate 100 user records
npx csv-faker -c id:uuid,name:name,email:email -r 100 -o users.csv

This creates a file with 100 rows containing random UUIDs, names, and emails.

More Examples

Generate customer data:

npx csv-faker --columns "userId:uuid,firstName:firstName,lastName:lastName,email:email,phone:phone" --rows 50 --output customers.csv

Generate company data:

npx csv-faker -c id:uuid,company:company,city:city,country:country -r 20

Generate employee records with salary data:

npx csv-faker -c id:uuid,name:name,jobTitle:jobTitle,salary:number -r 200 --output employees.csv

Programmatic Usage

Use it directly in your Node.js or TypeScript projects:

import { generateCSV } from 'csv-faker-generator';

// Generate user test data
await generateCSV({
  columns: [
    { header: 'id', type: 'uuid' },
    { header: 'name', type: 'name' },
    { header: 'email', type: 'email' },
    { header: 'address', type: 'address' },
  ],
  rows: 100,
  output: 'users.csv',
});

Real-World Use Cases

Testing Data Import Features

When building a feature that imports CSV files, you need realistic test data:

npx csv-faker -c orderId:uuid,customerName:name,email:email,amount:number -r 1000 -o orders.csv

Now you have 1000 realistic order records to test your import logic.

Load Testing & Performance Testing

Generate large datasets quickly to test your application's performance:

npx csv-faker -c id:uuid,data:username,value:number -r 100000 -o large-dataset.csv

Prototyping & Demos

Show stakeholders what your data pipeline looks like with real-looking sample data instead of [SAMPLE DATA] placeholders.

Database Seeding

Generate initial data for your development environment:

import { generateCSV } from 'csv-faker-generator';
import { parseCSV } from './your-parser';

// Generate test data
await generateCSV({
  columns: [
    { header: 'id', type: 'uuid' },
    { header: 'username', type: 'username' },
    { header: 'email', type: 'email' },
  ],
  rows: 500,
  output: 'seed-data.csv',
});

// Then seed your database
const data = await parseCSV('seed-data.csv');
await database.insert(data);

Why I Built This

As an Engineer working heavily with data pipelines and API testing, I found myself repeatedly needing the same thing: quick, realistic test data. The existing solutions either required a lot of boilerplate code or were overly complex for simple use cases.
I wanted something that was:

  • Dead simple to use (one command)
  • Flexible for both CLI and programmatic use
  • Well-typed (since I work with TypeScript)
  • Focused on the specific problem of CSV generation

Open Source & Contributions

This package is completely open source (MIT licensed) and hosted on GitHub. If you find it useful, have feature requests, or want to contribute, I'd love to hear from you!

Repository: https://github.com/manojkken/csv-faker-generator

npm: https://www.npmjs.com/package/csv-faker-generator

Conclusion

Whether you're testing a data pipeline, prototyping an application, or just need realistic sample data, csv-faker-generator is here to save you time. Give it a try and let me know what you think!

npm install csv-faker-generator

Questions or feedback? Feel free to open an issue on GitHub or reach out to me on Twitter.

2 Comments

1 vote
1 vote

More Posts

How to use Builder design Pattern for test data generation in automation testing

Faisal khatri - Oct 14, 2024

Mastering Reading and Writing CSV Files in Python

Abdul Daim - Mar 27, 2024

10 Smart Tech Tips to Boost Your Website Performance in 2025

NewsifyPro - Aug 24

Guide to Python's CSV Module

Nuno Bispo - Oct 23, 2024

Meet the .csv datasets and understand how they works on creating expert system Artificial Intelligence models

Elmer Urbina - Oct 19, 2024
chevron_left