Relational Test Data Generator

Generate referentially-consistent test data across related tables: users, orders, and line items with valid foreign keys, a fixed seed, and JSON or SQL export. Free, runs in your browser.

This free generator builds a small relational dataset the way a real database would: users, their orders, and each order’s line items, all wired together with valid foreign keys. Pick a seed and the row counts, then export the result as JSON or ready-to-run SQL. Nothing is uploaded; every dataset is produced in your browser.

Try a preset

Powered by Tillage, our open-source relational test-data library. The data below is generated by the same engine you can run in your own tests with npm i tillage.

Generated 6 users, 18 orders, and 36 line items: 60 referentially-consistent rows in total.
users (6)
idnameemailcity
1Yuki Haddadyuki.haddad@example.comDenver
2Zoe Novakzoe.novak@example.comOsaka
3Zoe Meyerzoe.meyer@example.comAustin
4Sofia Bergsofia.berg@example.comLisbon
5Elsa Lindqvistelsa.lindqvist@example.comLisbon
6Ava Adeyemiava.adeyemi@example.comOslo
orders (18)
iduserIdstatustotal
11shipped507.44
21delivered548.86
31pending111.46
42refunded751.18
52paid371.81
62paid1086.88
73shipped819.91
83delivered286.46

+10 more rows (in JSON / SQL export)

line_items (36)
idorderIdproductquantityunitPrice
11Ergonomic Mouse447.83
21Docking Station2158.06
32Laptop Stand2221.11
42Ergonomic Mouse253.32
53Webcam45.94
63Desk Lamp517.54
74Standing Desk4134.93
84Webcam1211.46

+28 more rows (in JSON / SQL export)

What "relational" test data means

Most fake-data tools generate one column at a time: a name here, an email there, a random number for a price. That is fine for a single row, but a database is not a spreadsheet. An order has to belong to a user that actually exists, and a line_item has to point at an order that actually exists. When those links are wrong, your inserts fail on foreign-key constraints or, worse, succeed and leave you testing against data that could never occur in production.

Relational test data keeps those links intact. This generator assigns each table its own sequential primary keys, then wires every foreign key to a real parent row, so the whole dataset is internally consistent and safe to load into a schema with constraints turned on.

The gap this fills (and why faker alone does not)

Faker libraries are excellent at field values: realistic names, emails, addresses, prices. What they do not model is the relationship between records. Faker will happily give an order a user_id of 999 whether or not user 999 exists, because it has no concept of the rest of the dataset. Closing that gap by hand means bookkeeping: track which ids you created, hand them down to child records, and hope you did not fumble a reference.

This tool does that bookkeeping for you. It is a browser demo of Tillage, an open-source TypeScript library that adds the relational layer on top of faker so you can define factories and relationships in code and generate consistent datasets from your tests or seed scripts.

Deterministic seeds: the same data every run

Every dataset here is a pure function of its seed and counts. Enter the same seed and you get byte-for-byte the same users, orders, and line items, in the same order, every time. That is what makes seeded data useful for tests: a failure is reproducible, a snapshot is stable, and a teammate running the same seed sees exactly what you saw. Change the seed and you get a completely different but equally consistent dataset.

How to use this generator

  1. Choose a preset, or set the seed and the counts (users, orders per user, items per order) by hand.
  2. Read the live preview to see the three tables and how their foreign keys line up.
  3. Switch to the JSON or SQL tab and copy the output. The SQL is Postgres-flavored and emits the tables parent-first, so the script runs top to bottom against an empty database with every foreign key satisfied.

To generate data from your own schema with your own factories, install the library with npm i tillage and define the relationships in code.

Frequently asked questions

What is a relational test data generator?

It is a tool that creates fake data across multiple related tables at once and keeps the links between them valid, so every foreign key points at a row that actually exists. That lets you load the data into a real schema with constraints enabled without integrity errors.

How is this different from Faker or Mockaroo?

Faker generates individual field values and has no concept of relationships between records. This generator wires foreign keys to real parent rows across tables. It is a browser demo of the open-source Tillage library, which adds that relational layer on top of faker.

Can I export the data as SQL?

Yes. The SQL tab produces Postgres-flavored CREATE TABLE and INSERT statements, ordered parent-first so the whole script runs against an empty database with every foreign key satisfied. There is also a JSON tab.

Is the generated data the same every time?

For a given seed and set of counts, yes. The dataset is deterministic, so the same seed always reproduces the same rows in the same order. Change the seed to get a different but equally consistent dataset.

Does this send my data anywhere?

No. Generation runs entirely in your browser. Nothing is uploaded or stored on a server.

How do I generate data for my own tables?

Install the open-source library with npm i tillage and define your own factories and relationships in code. This page demonstrates a fixed users, orders, and line-items schema; the library works with any schema you describe.