Feature Flags
Feature flags are the foundation of Supaship. They let you control features at runtime without redeploying code. With flags, you can roll out safely, test with real users, and respond instantly if something breaks.
What are Feature Flags?
Feature flags are switches in your code that Supaship controls remotely. Instead of hardcoding whether a feature is on or off, you check the flag value at runtime.
const isEnabled = await client.getFeature('new-checkout-flow')
if (isEnabled) {
renderNewCheckout() // New feature
} else {
renderOldCheckout()
}Why use them?
- Ship code safely – Deploy features disabled, enable when ready
- Test in production – Enable for specific users or percentages
- Instant rollbacks – Turn off broken features without redeploying
- Gradual rollouts – Start with 1%, increase to 100% over time
Creating a Feature Flag
- Go to your project and click “Create Feature Flag”
- Enter a name (lowercase, numbers, hyphens only) – e.g.,
new-checkout-flow - Choose a type: Boolean (on/off) or JSON (structured data)
- Click “Create”
After creation, configure targeting rules to control who sees the feature.
Flag Types
Boolean Flags
Simple true/false switches for enabling or disabling features.
const isEnabled = await client.getFeature('beta-banner')
if (isEnabled) {
showBetaBanner()
}Use cases: Toggle features, beta banners, A/B tests
JSON Flags
Return structured data for complex configurations.
const config = await client.getFeature('api-config')
const apiClient = new ApiClient(config)Use cases: API configurations, feature settings, experiment parameters
Note: Need string or number values? Use a JSON flag with a single property.
Best Practices
Naming Conventions
- Use descriptive, lowercase names with hyphens
- Use a period to group related flags
- Examples:
new-checkout-flow,beta-features,dark-mode
Monitoring and Analytics
Track Feature Usage
Monitor how your features are being used:
- Real-time metrics - Live feature usage data
- User engagement - Track how features affect behavior
- Performance monitoring - Monitor flag evaluation times
- Custom events - Track specific user actions