Feature Management
Define, categorize, and enforce Boolean, Numeric, and String features with automatic quota tracking and high-performance caching.
Features are the atomic building blocks of your entitlements system. Every capability that can be toggled, limited, or configured per plan is defined as a Feature. The system supports three value types, automatic seeding, and real-time quota enforcement.
Feature Value Types
Each feature has a specific value type that determines how it is evaluated, stored, and enforced across editions and overrides.
| Type | Values | Example | Enforcement |
|---|---|---|---|
| Boolean | true / false | ApiAccess, CustomDomain, SSO | Feature gate: allow or block |
| Numeric | Integer value | MaxUsers: 50, StorageGB: 100 | QuotaCounter: auto-reject when exceeded |
| String | Free text | SupportTier: 'Priority', Theme: 'dark' | Configuration value, no enforcement |
System vs Custom Features
System Features
Pre-seeded at application startup. Immutable and always present. Define the core capabilities of your platform (e.g., MaxUsers, ApiAccess).
Custom Features
Created by administrators at runtime via the API. Perfect for module-specific features that evolve as your product grows.
Automatic Quota Enforcement
Numeric features can have associated QuotaCounter entities that track real-time usage. When a command implements IRequireFeature for a numeric feature, the FeatureCheckBehavior pipeline automatically compares the current count against the allowed limit.
High-Performance Feature Caching
Resolved feature values are aggressively cached per-tenant to ensure zero-latency authorization checks. The cache is automatically invalidated whenever editions, subscriptions, or overrides change.
Sub-Millisecond Lookups
Resolved features are cached in-memory per tenant. Pipeline checks complete in microseconds, not milliseconds.
Automatic Invalidation
Any change to editions, subscriptions, or overrides immediately invalidates the affected tenant's feature cache.
API Endpoints
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/features | List all features | 🔒 Required |
| POST | /api/features | Create custom feature | 🔒 Required |
| PUT | /api/features/{id} | Update feature | 🔒 Required |
| DELETE | /api/features/{id} | Delete custom feature | 🔒 Required |
| GET | /api/features/resolved | Get resolved features for current tenant | 🔒 Required |