Skip to content

Repository files navigation

fabricator

@ghostry/fabricator

Fabricate typed data from composable schemas.

Full type inference, seeded reproducibility, and fixtures that don't churn when the schema changes.

npm npmx jsr github typescript bun node

Documentation  ·  Guides  ·  API Reference

Packages

This is the monorepo for fabricator and its companion packages.

Package Version Description
@ghostry/fabricator npm version The core library.
@ghostry/fabricator-adapter-typebox-v0 npm version Converts any Fabricator Schema to a TypeBox v0 schema.
@ghostry/fabricator-extension-faker-v10 npm version Faker v10 generators, seeded through the fabricator instance that calls them.

Install

npm install @ghostry/fabricator

Example

import { initialize } from "@ghostry/fabricator";

const { T, Fabricator } = initialize();

const ProductSchema = T.object({
  name: T.string.whereby({ length: { min: 1, max: 25 } }),
  price: T.number.whereby({ min: 1, max: 500 }),
  inStock: T.boolean,
});

const Product = new Fabricator(ProductSchema);

const item = Product.fabricate();
// { name: "...", price: ..., inStock: ... }

See the docs site for the full guide.

License

MIT © Patrick Rebsch

About

Fabricate typed data from composable schemas.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages