Hypertune
  • Introduction
  • Getting Started
    • Set up Hypertune
    • Next.js (App Router) quickstart
    • Next.js (Pages Router) quickstart
    • React quickstart
    • Remix quickstart
    • Gatsby quickstart
    • Vue quickstart
    • Nuxt quickstart
    • Node.js quickstart
    • React Native quickstart
    • JavaScript quickstart
    • Python quickstart
    • Rust quickstart
    • Go quickstart
    • Web quickstart
    • GraphQL quickstart
  • Example apps
    • Next.js and Vercel example app
  • Concepts
    • Architecture
    • Project
    • Schema
    • Flag lifecycle
    • Logic
    • Variables
    • Splits
    • A/B tests
    • Staged rollouts
    • Multivariate tests
    • Machine learning loops
    • Events
    • Funnels
    • Hypertune Edge
    • Reduction
    • SDKs
    • GraphQL API
    • Git-style version control
    • App configuration
  • Use Cases
    • Feature flags and A/B testing
    • Landing page optimization
    • In-app content management
    • Pricing plan management
    • Permissions, rules and limits
    • Optimizing magic numbers
    • Backend configuration
    • Product analytics
  • Integrations
    • Vercel Edge Config integration
    • Google Analytics integration
    • Segment integration
    • Webhooks
      • Creating webhooks
      • Handling webhooks
  • SDK Reference
    • Installation
    • Type-safe client generation
    • Initialization
    • Build-time logic snapshot
    • Hard-coded fallbacks
    • Local-only, offline mode
    • Hydrate from your own server
    • Wait for server initialization
    • Provide targeting attributes
    • Local, synchronous evaluation
    • Remote logging
    • Getting flag updates
    • Serverless environments
    • Vercel Edge Config
    • Custom logging
    • Shutting down
Powered by GitBook
On this page
  • Hyperlang
  • Input types and targeting attributes
  • Variables and user segments
  • A/B tests, staged rollouts and machine learning loops
  • Logging events
  • Analytics
  • Comments
  • Permissions and roles
  • Type-directed logic builder
  • Type-checking
  1. Concepts

Logic

PreviousFlag lifecycleNextVariables

Last updated 10 months ago

Hyperlang

Once you've defined a feature flag in your schema, you can add targeting rules to define when the flag should be on.

You build these rules in Hyperlang, our visual, functional, statically-typed configuration language.

Since Hyperlang is a full programming language, you can insert arbitrarily complex rules.

Input types and targeting attributes

When building rules, you can reference targeting attributes that you defined on the input types in your , e.g. context.user.id, context.environment or context.organization.plan.

Variables and user segments

You can convert any Hyperlang expression into a .

This lets you create user segments, e.g. a list of beta user IDs, that you can reuse across the logic of different flags.

A/B tests, staged rollouts and machine learning loops

Hyperlang also lets you embed , , and anywhere in your flag logic. These are all different types of .

So you can have a single feature flag with rules to enable the feature for specific users, e.g. employees, QA, beta users, etc, and a final default rule to A/B test the feature on everyone else.

It also means you can reuse a single A/B test across the logic of different feature flags to roll out and test related features in sync.

Logging events

  • See drop-off rates between different event types

  • Compare conversion rates across different arms of an A/B test or machine learning loop

  • Set goals for machine learning loops

Analytics

Live counts are overlaid on your flag targeting logic so you can see how often different targeting rules are evaluated and passed in realtime.

Comments

You can add a comment to any Hyperlang expression, e.g. to explain a feature flag, a specific targeting rule, a list of IDs or a specific ID.

Permissions and roles

You can set permissions on any Hyperlang expression.

This lets you safely empower nontechnical teammates to update specific parts of your flag logic. For example, you could let product managers edit a list of user IDs for a specific flag targeting rule, but not the structure of the rule, or the other rules on the flag.

Type-directed logic builder

The Hyperlang logic builder interface is "type-directed". This means it only lets you insert expressions that satisfy the required type of the hole in the logic tree. So for a Boolean feature flag defined in your schema, you can insert a primitive Boolean expression or an If / Else expression that returns a Boolean. If you insert an If / Else expression, more holes appear.

This results in an intuitive interface such that nontechnical users don't need to know any syntax and can't get into invalid states.

Type-checking

However, if you make a breaking change to your schema, e.g. by removing or renaming a flag, you'll see a type error that you'll need to fix.

Since your schema and logic are saved and deployed together in a single commit, you won't be able to save your changes if there are any type errors that need fixing.

Hyperlang also lets you log , e.g. SignUpEvent, PurchaseEvent, etc, for Void event trigger flags in your schema, and then build out of them to:

Hyperlang is statically-typed and your logic is type-checked against your . Since the logic builder interface is type-directed, you typically won't encounter any type errors.

schema
variable
A/B tests
staged rollouts
multivariate tests
machine learning loops
splits
events
funnels
schema