Always check environment variables, deployment modes, subscription tiers, and feature flags before enabling functionality or changing application behavior. Combine multiple configuration checks when necessary to ensure features are only available in appropriate contexts.
Key practices:
Example implementation:
// Check environment type for dev-only features
{currentEnvironment?.type === EnvironmentTypeEnum.DEV ? (
<DevelopmentEditor />
) : (
<ProductionView />
)}
// Combine subscription tier with feature limits
if (tier === ApiServiceLevelEnum.FREE && data?.layouts?.length >= 1) {
return <UpgradePrompt />;
}
// Combine feature flags with deployment mode
{isWebhooksManagementEnabled && !IS_SELF_HOSTED && (
<WebhooksSection />
)}
// Different behavior for deployment modes
{IS_SELF_HOSTED ? 'Contact Sales' : 'Upgrade to Team Tier'}
This approach prevents features from being exposed in inappropriate environments and ensures consistent behavior across different deployment scenarios.
Enter the URL of a public GitHub repository