Skip to content
Logo

fabricator

Fabricate typed data from composable schemas.

fabricator builds test data from schemas you define — with full type inference, seeded reproducibility, and a small set of composable primitives covering scalars, collections, absence, recursion, and an escape hatch for anything else.

import { initialize } from "@ghostry/fabricator";
 
const { T, Fabricator } = initialize({ seed: "1234" });
 
const ProductSchema = T.object({
  name: T.string.whereby({ length: { min: 1, max: 25 } }),
  price: T.number.whereby({ min: 1, max: 500 }),
  tags: T.array(T.string.whereby({ length: { max: 15 } })),
});
 
const item = new Fabricator(ProductSchema).fabricate();

Start here

Installation, then the quick start and mental model — Registry, Schema, Fabricator, and why building is where randomness happens.

Guides

Primitives

Overview groups them by the question you're holding; All in the sidebar is one page per name.