How do entitlements and feature gating work?
Controlling Feature Access by Tier
If you have multiple tiers (Free, Team, Enterprise) with different feature sets, you need a way to gate access based on what plan a customer is on. Here's how Lava handles this.
How It Works
In Lava, entitlements are managed through the relationship between plans and meters. Each plan defines which meters are included. A meter represents a trackable action or feature in your product.
To check if a customer has access to a feature:
- Query the Lava SDK for the customer's current plan
- Check which meters are included in that plan
- If the meter for a specific feature exists in the plan, the customer has access
- If the meter doesn't exist, they don't
Example
Say you have three features: Basic Search, Advanced Analytics, and Priority Support.
- Free tier — Plan includes only the "Basic Search" meter
- Team tier — Plan includes "Basic Search" and "Advanced Analytics" meters
- Enterprise tier — Plan includes all three meters
In your code, you check the customer's plan to see which meters are present. If "Advanced Analytics" isn't in their plan, you block access to that feature.
Custom Entitlements per Customer
For enterprise or custom deals where a specific customer gets a different feature set, you create a separate plan/tier for them with the appropriate meters. This gives you full flexibility without hardcoding customer-specific logic.
Changing Entitlements
When you want to change what's included in a tier, you update the plan configuration in the Lava dashboard. The changes apply to all customers on that plan. No code deployment needed.
Rate Limits per Tier
Each meter in a plan can have its own rate and usage limits. So the Free tier might get 100 searches per month at $0, while the Team tier gets 10,000 searches at a lower per-unit rate. This lets you differentiate tiers not just by feature access, but also by usage allowances.