Multi-set workflows
Sets
Sets let you split a single Featurevisor project into independent trees that each own their own attributes, segments, features, targets, and tests.
When to use sets#
A regular project keeps all definitions in one tree, where every feature carries its own environment specific rules inside the same file.
Sets are useful when you want fully separated trees instead, for example:
- modeling
dev,staging, andproductionas independent release lanes, where the same feature key can have very different rules in each lane - managing distinct surfaces like
storefrontandadminfrom one repository, where each surface has its own attributes and segments
The same feature key can exist in more than one set, with different rollout behavior in each.
Enabling sets#
Set sets to true in your configuration:
module.exports = { sets: true, tags: ['all'],}By default sets is false.
Directory structure#
Each set lives under the sets directory, in its own subdirectory. Inside it, a set has the same layout as a regular project:
sets/├── storefront/│ ├── attributes/│ ├── segments/│ ├── features/│ ├── targets/│ └── tests/└── admin/ ├── attributes/ ├── segments/ ├── features/ ├── targets/ └── tests/The set name is the directory name, like storefront and admin above.
Each set needs at least one target of its own, just like a regular project.
Building datafiles#
Run the usual build command:
$ npx featurevisor buildFeaturevisor builds every set and writes its datafiles under a directory named after the set:
datafiles/├── storefront/│ └── production/│ └── featurevisor-all.json└── admin/ └── production/ └── featurevisor-all.jsonIf your project also defines environments, the environment directory sits inside the set directory:
datafiles/└── storefront/ ├── staging/ │ └── featurevisor-all.json └── production/ └── featurevisor-all.jsonState files are kept per set under .featurevisor/sets/<set>/.
Working with a single set#
Pass --set=<set> to limit a command to one set:
$ npx featurevisor build --set=storefront$ npx featurevisor test --set=adminWhen you print a datafile as JSON in a project with sets enabled, you have to pick a set:
$ npx featurevisor build --set=storefront --environment=production --json --prettyTesting#
Tests run for every set by default:
$ npx featurevisor testTest specs live inside each set's own tests directory, next to the features and segments they cover. To run tests for a single set, pass --set:
$ npx featurevisor test --set=storefrontPromotion between sets#
When sets model release lanes, you can copy definitions from one set to another using promotions. For example, you can promote a feature's definition from dev to staging, and later from staging to production.
Read more in the Promotions page.
Comparison#
Sets sit alongside the other ways Featurevisor helps you organize a project:
- Environments: different sets of rules per feature, defined inside the same feature file
- Tags: group features so targets can select them
- Namespaces: organize features and segments hierarchically within a single tree
- Sets: split the project into independent trees that each own their own definitions

