Basestack Docs
User Guide

Feature Flags

Feature flags are the core of Basestack Feature Flags. They allow you to control feature rollouts, test new functionality, and manage feature availability across different environments. This guide covers everything you need to know about creating and managing feature flags.

What Are Feature Flags?

Feature flags (also called feature toggles) are:

  • Switches - Enable or disable features without code changes
  • Environment-Specific - Different states for dev, staging, and production
  • Configurable - Include payloads for additional configuration
  • Time-Limited - Can have expiration dates
  • Trackable - Activity history for all changes

Feature flags enable continuous deployment by allowing you to deploy code that's disabled by default, then enable it when ready.

Creating a Feature Flag

Open Create Flag Modal

Navigate to your project's Feature Flags page and click Create Feature Flag:

  • From the toolbar at the top of the flags list
  • From the empty state if you have no flags yet

The create flag modal opens with three tabs: Core, Advanced, and Activity.

Configure Core Settings

In the Core tab, configure the essential flag settings:

Feature Key (Required):

  • A unique identifier for your flag
  • Must be 1-150 characters
  • Avoid spaces and special characters
  • Example: header_size, new_checkout_flow, dark_mode

Description (Optional):

  • A brief description of what the flag controls
  • Maximum 120 characters
  • Helps team members understand the flag's purpose

Enabled Environments:

  • Select which environments should have this flag enabled
  • You can enable/disable per environment
  • Each environment can have different settings

Use descriptive feature keys that clearly indicate what the flag controls. This makes it easier to find and manage flags later.

Configure Advanced Settings (Optional)

In the Advanced tab, configure additional options:

Expiration Date:

  • Set when the flag should automatically expire
  • Useful for temporary features or A/B tests
  • Format: dd/mm/yyyy

Payload:

  • JSON object with additional configuration
  • Can include any data your application needs
  • Example: {"theme": "dark", "size": "large"}

Payloads are useful for feature flags that need configuration beyond just enabled/disabled. For example, a theme flag might include color values.

Create the Flag

Click Create to create your feature flag. The flag will be created with the settings you configured for each selected environment.

Once created, you can immediately use the flag in your application using one of our SDKs.

Managing Feature Flags

Viewing Flags

The Feature Flags page displays all flags in your project. You can:

  • View as Cards - Visual card layout with flag details
  • View as Table - Compact table view for quick scanning
  • Switch Views - Toggle between card and table views

Each flag card/row shows:

  • Flag name (feature key)
  • Description
  • Creation date
  • Enabled/disabled status per environment
  • Quick actions (Edit, Delete, Activity)

Searching and Filtering

Use the search bar in the toolbar to:

  • Filter by Name - Find flags by their feature key
  • Real-time Search - Results update as you type
  • Clear Search - Reset to show all flags

Editing Flags

To edit a flag:

  1. Click Edit on the flag card/row
  2. Modify settings in the modal (same tabs as creation)
  3. Click Update to save changes

Changes to flags are immediately available through the API. Your application will receive updated flag values on the next fetch.

Deleting Flags

To delete a flag:

  1. Click Delete on the flag card/row
  2. Confirm the deletion in the modal
  3. Review the warning about permanent deletion

Deleting a flag is permanent and cannot be undone. All associated comments, activity, and collaborator associations will be removed.

Viewing Flag Activity

Click Activity on any flag to see:

  • Creation history
  • All updates and changes
  • Who made each change
  • Timestamps
  • Previous values

This is useful for:

  • Auditing changes
  • Understanding flag evolution
  • Debugging issues
  • Compliance requirements

Flag States Per Environment

Each flag can have different states in different environments:

  • Development - Enable for testing
  • Staging - Test before production
  • Production - Control rollout to users

Use different flag states across environments to safely test features before enabling them in production.

Flag Payloads

Payloads allow you to include additional configuration with your flags:

Example Payloads

Theme Configuration:

{
  "theme": "dark",
  "primaryColor": "#000000",
  "fontSize": "16px"
}

Feature Configuration:

{
  "maxItems": 10,
  "sortOrder": "desc",
  "showPreview": true
}

A/B Test Variant:

{
  "variant": "B",
  "discount": 0.15,
  "message": "Special Offer!"
}

Payloads must be valid JSON. Use the JSON editor in the Advanced tab to create and validate your payload.

Best Practices

Naming Conventions

  1. Use Descriptive Names - new_checkout_flow is better than flag_1
  2. Use Snake Case - header_size instead of headerSize or Header Size
  3. Be Consistent - Follow a naming pattern across your project
  4. Include Context - mobile_dark_mode is clearer than dark_mode

Flag Lifecycle

  1. Create - Create the flag disabled in production
  2. Develop - Enable in development for testing
  3. Test - Enable in staging for QA
  4. Rollout - Gradually enable in production
  5. Monitor - Watch for issues and usage
  6. Cleanup - Delete flags that are no longer needed

Environment Strategy

  1. Development First - Always test flags in development
  2. Staging Validation - Verify in staging before production
  3. Gradual Rollout - Enable flags gradually in production
  4. Monitor Closely - Watch metrics when enabling flags

Payload Management

  1. Keep It Simple - Don't overcomplicate payloads
  2. Document Structure - Document expected payload structure
  3. Validate in Code - Validate payloads in your application
  4. Version Payloads - Consider versioning for breaking changes

Integration

After creating flags, integrate them into your application:

  1. Get Your Keys - Copy project and environment keys from Settings → General
  2. Install SDK - Install the appropriate SDK for your stack
  3. Initialize - Configure the SDK with your keys
  4. Use Flags - Check flag states in your code

See the JavaScript SDK documentation for detailed integration instructions for your technology stack.

Common Use Cases

Gradual Feature Rollout

  1. Create flag disabled in production
  2. Enable for internal testing
  3. Enable for beta users
  4. Enable for all users

A/B Testing

  1. Create flag with variant payload
  2. Enable for percentage of users
  3. Measure results
  4. Roll out winning variant

Emergency Kill Switch

  1. Create flag for critical feature
  2. Keep it easily accessible
  3. Disable immediately if issues arise
  4. Fix and re-enable

Environment-Specific Features

  1. Create flag enabled in development
  2. Keep disabled in production
  3. Use for debugging and testing
  4. Enable in production when ready

Next Steps

Now that you understand feature flags:

  1. Set up environments →
  2. Configure project settings →
  3. Integrate with SDKs →