Building datafiles

Datafiles are JSON files that are created against combinations of tags and environments. They are used to evaluate features in your application via Featurevisor SDKs.


Use Featurevisor CLI to build your datafiles:

$ featurevisor build


The build output can be found in the dist directory.

If your featurevisor.config.js file looks like this:

// featurevisor.config.js
module.exports = {
  tags: ["all"],
  environments: ["staging", "production"],

Then the contents of your dist directory will look like this:

$ tree dist
├── production
│   └── datafile-tag-all.json
└── staging
    └── datafile-tag-all.json

2 directories, 2 files

Next to datafiles, the build process will also generate some additional JSON files that we can learn about in State files.


By default, Featurevisor will use the version as exists in package.json of the project as the revision value in generated datafiles.

You can optionally customize the revision value in datafiles by passing a --revision flag when building:

$ featurevisor build --revision 1.2.3


You can print the contents of a datafile for a single feature without writing anything to disk by passing these flags:

$ featurevisor build --feature=foo --environment=production --print --pretty

This is useful primarily for debugging and testing purposes.

If you are an SDK developer in other languages besides JavaScript, you may want to use this handy command to get the generated datafile content in JSON format that you can use in your own test runner.