Skip to content

anoopsimon/datagen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DataGen API (Bun)

Simple tool built on the Bun runtime to see how cool Bun really is. Learn more about Bun here: https://bun.com/docs

This tool exposes REST endpoints (API Docs) to easily consume and generate data programmatically (e.g., seed test frameworks before runs).

Lightweight HTTP API that produces synthetic data (customers, accounts, transactions, and more) for testing dashboards or integrations. Location-aware data keeps phone numbers, addresses, and postal codes consistent with the selected country and state.

UI preview

App UI

Run the API

From source (Bun):

bun run index.ts
# specify a port
PORT=4000 bun run index.ts

Installed via npm (global):

npm i -g datagenstudio
datagenstudio
# specify a port (cross-platform)
datagenstudio --port 4000
# or shorthand
datagenstudio -p 4000

Installed locally in a project:

npm i datagenstudio
npx datagenstudio
# or specify a port
npx datagenstudio --port 4000
npx datagenstudio -p 4000

Endpoints

  • GET /health readiness check.
  • GET /customers list of generated customers.
  • GET /accounts customers plus their generated accounts.
  • GET /transactions customers, accounts, and transactions.

All endpoints accept the same query params:

Param Default Notes
country australia One of australia, india, united-kingdom/uk, united-states/usa
state random for selected country Match a state key for the chosen country (e.g. vic, karnataka, england, california)
emailDomains example.com Comma-separated domains for emails; invalid domains are ignored; one is picked per customer
format json Response format: json, yaml, or xml (or send Accept: application/xml / application/x-yaml)
seed current timestamp Set for deterministic runs
customers 10 Number of customers
minAccounts 1 Min accounts per customer
maxAccounts 3 Max accounts per customer
minTransactions 3 Min transactions per account
maxTransactions 8 Max transactions per account
currency country default (AUD/INR/GBP/USD) Override if you want a different currency
minAmount 10 Min transaction amount
maxAmount 500 Max transaction amount
startDate 1 month ago ISO date (inclusive)
endDate now ISO date (inclusive)

The customer payload now includes country, state, city, postal code, and localized phone/mobile formats to match the selected territory.

Example requests

# Default dataset
curl "http://localhost:3000/transactions"

# Deterministic dataset with tighter ranges
curl "http://localhost:3000/transactions?seed=42&customers=5&minAccounts=1&maxAccounts=2&minTransactions=2&maxTransactions=4&minAmount=5&maxAmount=120&startDate=2024-01-01&endDate=2024-02-01"

# Customers only (India / Karnataka, INR)
curl "http://localhost:3000/customers?seed=99&customers=3&country=india&state=karnataka&currency=INR"

Responses include a meta block describing the generation config and a data block with the generated objects.

Contributing & publishing

  1. Fork/branch and make your changes.
  2. Ensure Bun is installed; run bun run index.ts to verify the server boots.
  3. Keep tests/manual checks lean (no current test suite).
  4. For CLI packaging, ensure bin/datagenstudio.js remains in sync with package.json bin mapping.
  5. Update version and metadata in package.json as needed.
  6. Publish (requires registry access):
    • npm: npm publish --access public
    • bun: bun publish

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published