# Fabrikk

An entity generation library for Clojure

[![Clojars Project](https://img.shields.io/clojars/v/org.clojars.joe-douglas/fabrikk.svg)](https://clojars.org/org.clojars.joe-douglas/fabrikk)

#### **Library Status: Beta**

I don't anticipate making any more breaking changes to the API, but expect bugs and rough edges.

## Introduction

Fabrikk is a pure clojure library for generating realistic data for your tests or development workflow. It lets you quickly build entities from your application domain by defining a factory for each one, provides a high degree of control over how they're constructed, and models associations between them.

Fabrikk aims to let you specify only the data that's important to your current use case, and to handle all the rest of the details, including building associated entities. As an example: if your post requires an author user, Fabrikk can build one automatically when you build a post. It can output these hierarchies of entities as pure data, or it can be integrated with your persistence layer to build each entity in the correct order.

## Usage

Include it in your `deps.edn` (see clojars for other dependency management mechanisms)

```clojure
org.clojars.joe-douglas/fabrikk {:mvn/version "0.0.53"}
```

Require it in your namespace:

```clojure
(ns demo
  (:require [fabrikk.alpha.core :as fab]))
```

Then write some factories:

```clojure
(def user
  (fab/->factory 
    ::user
    {:template {:name "John Smith"
                :email "john@example.org"
                :role "admin"}}))
```

And start building:

```clojure
(fab/build user {:with {:name "John Murphy"}})
;; => {:name "John Murphy", :email "john@example.org", :role "admin"}
```

Sound good? Then jump straight into the [tutorial](https://deadeyejoe.gitbook.io/fabrikk/tutorial/factories-and-building)!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://deadeyejoe.gitbook.io/fabrikk/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
