{"id":13595526,"url":"https://github.com/whitfin/jen","last_synced_at":"2025-08-22T01:33:05.950Z","repository":{"id":62441288,"uuid":"190826000","full_name":"whitfin/jen","owner":"whitfin","description":"A fast utility to generate fake/test documents based on a template","archived":false,"fork":false,"pushed_at":"2024-01-05T22:31:27.000Z","size":79,"stargazers_count":62,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-11T12:26:10.016Z","etag":null,"topics":["data","dataset","generator","json","template","templating"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whitfin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-06-08T00:03:26.000Z","updated_at":"2024-11-29T22:25:56.000Z","dependencies_parsed_at":"2024-01-16T22:19:45.305Z","dependency_job_id":"48c3d431-0432-4f4d-a85d-2d16c329f803","html_url":"https://github.com/whitfin/jen","commit_stats":{"total_commits":47,"total_committers":1,"mean_commits":47.0,"dds":0.0,"last_synced_commit":"a9eaa058ad22e2b89edb94a45c3c6ceb7c7053c0"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whitfin%2Fjen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whitfin%2Fjen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whitfin%2Fjen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whitfin%2Fjen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whitfin","download_url":"https://codeload.github.com/whitfin/jen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230547682,"owners_count":18243227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data","dataset","generator","json","template","templating"],"created_at":"2024-08-01T16:01:51.804Z","updated_at":"2024-12-20T07:07:29.032Z","avatar_url":"https://github.com/whitfin.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Jen\n[![Build Status](https://img.shields.io/github/actions/workflow/status/whitfin/jen/ci.yml)](https://github.com/whitfin/jen/actions)\n[![Crates.io](https://img.shields.io/crates/v/jen.svg)](https://crates.io/crates/jen)\n\nA simple (but extensible) tool for generating large random datasets.\n\nJen is a combination of a core library and a CLI, used to generate random\ndatasets based on a template. There are existing tools for this purpose,\nbut most of them live in a browser and they're naturally insufficient when\nit comes to generating large amounts of data. Jen was created to fill the\nniche of creating larger amounts of data for things like unit tests and\ndatabase state.\n\nJen's underlying template syntax is drive by [Tera](https://github.com/Keats/tera)\nto aid in familiarity and to avoid re-inventing a templating language. On\ntop of this layer, Jen offers many helpers based around randomizing data.\nSeveral of these helpers are based on [fake](https://github.com/cksac/fake-rs),\nwith additional helpers provided where there are gaps. You can naturally\nattach your own helpers when using Jen programmatically.\n\n### Installation\n\nJen will be available via [Crates.io](https://crates.io/crates/jen), so it\ncan be installed from there directly. You can use Jen either as a command\nline utility, or directly via the programmatic API.\n\nIf you wish to install Jen as a command line utility, you can install it\nvia an easy one-liner in your terminal:\n\n```shell\n$ cargo install jen\n```\n\nIf you wish to use it as a library, you can add it to your `Cargo.toml`\nas a dependency of your application:\n\n```toml\n[dependencies]\njen = { version = \"1.7\", default-features = false }\n```\n\nYou should disable the default features as it includes several dependencies\nwhich are required for the CLI use case. These dependencies are not included\nin your application when these features are disabled.\n\n### Usage\n\nThe first step is to construct a template file which Jen will then use when\ngenerating data.  There are many template helpers provided by default, via\nthe internal `jen::helpers` module. You can check the documentation for the\nlatest list of helpers, although a fairly up to date table of helpers can\nbe found [below](#template-helpers). Once you have this template, you can\neither use Jen via the CLI, or programmatically.\n\n#### Command Line\n\nThe CLI is fairly simple, with a basic structure of:\n\n```shell\n$ jen \u003ctemplate\u003e\n```\n\nUsing this syntax will generate a random document based on the provided\ntemplate (which must be a valid Tera template). There is a basic document\nyou can test with inside the `example` directory.\n\nThere are various switches you can provide to adjust the output, including\nthe following (at the time of writing, there may be more):\n\n```text\nUSAGE:\n    jen [FLAGS] [OPTIONS] \u003ctemplate\u003e\n\nFLAGS:\n    -h, --help       Prints help information\n    -t, --textual    Treat the input as textual, rather than JSON\n    -V, --version    Prints version information\n\nOPTIONS:\n    -l, --limit \u003climit\u003e        An upper limit of documents to generate\n\nARGS:\n    \u003ctemplate\u003e    Template to control JSON generation\n```\n\nAlthough Jen works with any input formatting, it was originally written\nwith JSON documents in mind. As such, Jen will automically attempt to\nparse input (after generation) as JSON, in order to compact and emit\ndocuments once per line. This detection has a fair amount of overhead,\nwhich can be skipped by providing `-t` if you explicitly don't want to\ntreat incoming data as JSON.\n\nFor a complete and up to date list of options, please use `jen -h` in your\nterminal.\n\n#### Programmatic API\n\nThe programmatic API is pretty simple. Everything is handled through the\nuse of the `Generator` struct, which implements the `Iterator` trait to\nprovide continuous (lazy) documents.\n\nGenerators are constructed using a path to a template on disk, and you\nthen generate documents using the `Iterator` methods, as shown below.\n\n```rust\nlet mut generator = Generator::load(\"./example/example.tera\")\n    .expect(\"provided a value template\");\n\nfor document in generator.take(5) {\n    println!(\"{}\", document);\n}\n```\n\nThis will generate five documents from the provided template and print\nthem to the terminal.\n\n### Template Helpers\n\nBelow is a list of current helpers (at the time of writing). Please see the\ndocumentation uploaded to Crates.io for an up-to-date listing.\n\n| Helper                                 | Description                                           |\n|----------------------------------------|-------------------------------------------------------|\n| bool()                                 | Generates a random boolean value                      |\n| city()                                 | Generates a random city name                          |\n| company()                              | Generates a random company name                       |\n| domain()                               | Generates a random domain name                        |\n| email()                                | Generates a random email address                      |\n| firstName()                            | Generates a random first name                         |\n| float(start=f64::MIN, end=f64::MAX)    | Generates a random float value between two bounds     |\n| index()                                | Retrieves the current index of the generated document |\n| industry()                             | Generates a random industry type                      |\n| integer(start=i64::MIN, end=i64::MAX)  | Generates a random integer value between two bounds   |\n| lastName()                             | Generates a random last name                          |\n| latitude()                             | Generates a random latitude location value            |\n| longitude()                            | Generates a random longitude location value           |\n| name()                                 | Generates a random full name                          |\n| nanoid(length=21)                      | Generates a random nanoid of a given length           |\n| objectId()                             | Generates a random object identifier                  |\n| paragraph()                            | Generates a random paragraph of Lorem Ipsum           |\n| phone()                                | Generates a random phone number                       |\n| postcode()                             | Generates a random postcode value                     |\n| profession()                           | Generates a random job profession                     |\n| random(values=[\"red\",\"blue\",\"yellow\"]) | Retrieves a random value from the provided values     |\n| sentence()                             | Generates a random sentence of Lorem Ipsum            |\n| state()                                | Retrieves a random US state name                      |\n| stateCode()                            | Retrieves a random US state code                      |\n| street()                               | Generates a random street name                        |\n| timestamp()                            | Generates a random timestamp value in seconds         |\n| title()                                | Generates a random job title                          |\n| userAgent()                            | Generates a random browser user agent                 |\n| username()                             | Generates a random account username                   |\n| uuid()                                 | Generates a v4 UUID                                   |\n| word()                                 | Retrieves a random word of Lorem Ipsum                |\n| zip()                                  | Generates a random US zip code                        |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhitfin%2Fjen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhitfin%2Fjen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhitfin%2Fjen/lists"}