fejkdata
Locale-aware fake data for tests, fixtures and seed data, from JSON templates. fejkdata is both a CLI and a Go library, with the data built in and no dependencies.
Hello, world
A template is text with {...} tokens that each draw a value from fejkdata's data. This one draws a person from the en_US data:
{/en_US.person}
Pipe it into the CLI, here in sh, bash or zsh:
echo '{/en_US.person}' | fejkdata --seed 1
With fejkdata v0.8.0, that prints:
Elliot Young
How templates work
Install
- CLI on macOS or Linux, with Homebrew
brew install larvit/tap/fejkdata
- CLI on Windows, with Scoop
scoop bucket add larvit https://github.com/larvit/scoop-bucket && scoop install fejkdata
- CLI on any OS with Docker
docker run --rm -i larvit/fejkdata < template.json
It renders the template in template.json. On shared CI runners, pull ghcr.io/larvit/fejkdata instead: Docker Hub limits anonymous pulls per IP address.
- CLI on any OS with Go
go install github.com/larvit/fejkdata/cmd/fejkdata@latest
- Go library, in a Go project
go get github.com/larvit/fejkdata
Debian, Ubuntu, Fedora, RHEL, Alpine and release binaries
- Debian, Ubuntu
sudo curl -fsSLo /etc/apt/keyrings/fejkdata.asc https://larvit.github.io/fejkdata/fejkdata.asc
echo 'deb [signed-by=/etc/apt/keyrings/fejkdata.asc] https://larvit.github.io/fejkdata/deb stable main' | sudo tee /etc/apt/sources.list.d/fejkdata.list
sudo apt update && sudo apt install fejkdata
- Fedora, RHEL
sudo curl -fsSLo /etc/yum.repos.d/fejkdata.repo https://larvit.github.io/fejkdata/rpm/fejkdata.repo
sudo dnf install fejkdata
- Alpine, as root
wget -qO /etc/apk/keys/fejkdata.rsa.pub https://larvit.github.io/fejkdata/apk/fejkdata.rsa.pub
echo https://larvit.github.io/fejkdata/apk >> /etc/apk/repositories
apk add fejkdata
Each release also carries the binaries for Linux, macOS and Windows on amd64 and arm64, and the .deb, .rpm and .apk packages. The binaries are unsigned: macOS refuses to run one a browser downloaded until you run xattr -d com.apple.quarantine fejkdata.
All install options · The library
Try it
This runs fejkdata in your browser, with all its data. Nothing is sent anywhere.
The playground needs JavaScript.
The CLI, its flags and its shells
github.com/larvit/fejkdata · Every path fejkdata ships