Skip to content

yeojz/showwhat

Repository files navigation

showwhat-logo

showwhat

Feature flags and config you own. Platform-agnostic.

Define flags and config as variations with conditions in YAML or JSON. At runtime, showwhat evaluates those definitions against a context object and resolves the first matching value: booleans, strings, numbers, or full objects. Store definitions in files, serve them from an API, or manage them in version control. Like OpenAPI for APIs, showwhat gives you a spec-first workflow with tooling built around it.

Documentation · Quick Start

Packages

Package Description
showwhat Main API for resolving feature flags and config values
@showwhat/core Rule engine, schemas, parsers, and in-memory data source
@showwhat/configurator React UI library for visual rule editing
@showwhat/openfeature OpenFeature bridge for showwhat definitions
webapp Browser app for authoring and testing definitions
docs Documentation site

Quick start

npm install showwhat
pnpm add showwhat
yarn add showwhat

# Other runtimes
bun add showwhat
deno install npm:showwhat
import { showwhat, MemoryData } from "showwhat";

const data = await MemoryData.fromYaml(`
definitions:
  checkout_v2:
    variations:
      - value: true
        conditions:
          - type: env
            value: prod
      - value: false
`);

const result = await showwhat({
  keys: ["checkout_v2"],
  context: { env: "prod" },
  options: { data },
});

const entry = result["checkout_v2"];
if (entry.success) {
  console.log(entry.value); // true
}

Definition format

Definitions are YAML or JSON documents with a definitions root key. Each definition has one or more variations evaluated in order. The first matching variation wins. Use definitions for boolean flags, config values, or structured objects.

definitions:
  my_flag:
    variations:
      - value: "on"
        conditions:
          - type: env
            value: [prod, staging]
      - value: "off" # default (no conditions = always matches)

Built-in condition types

  • Primitives: string | number | bool | datetime
  • Shorthands: env | startAt | endAt
  • Composites: and | or | matchAnnotations

See the Conditions guide for full details.

Security

showwhat assumes definition authors are trusted. See the Security guide for considerations when accepting definitions from untrusted sources.

AI Usage Disclosure

The codebase, tests, and documentation was created with AI assistance, with outputs reviewed by humans. See CONTRIBUTING.md for guidelines.

License

MIT

About

Schema and rule engine for feature flags and config resolution. Inspired by OpenAPI and Swagger

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Contributors