Feature gating, subscription plan management, usage quota tracking, and metered billing. Define what each plan unlocks, check entitlements at runtime, and track usage against monthly or per-cycle limits — all without writing billing logic yourself.
nself plugin install entitlements
nself build
nself start# Define a plan
curl -X POST https://api.yoursite.com/entitlements/plans \
-H "Authorization: Bearer $TOKEN" \
-d '{
"name": "pro",
"features": ["exports", "api-access", "advanced-search"],
"quotas": {"api_calls": 10000, "exports": 100}
}'
# Check a feature at runtime
curl -X POST https://api.yoursite.com/entitlements/check \
-H "Authorization: Bearer $TOKEN" \
-d '{"user_id": "u1", "feature": "exports"}'
# Track usage
curl -X POST https://api.yoursite.com/entitlements/usage \
-H "Authorization: Bearer $TOKEN" \
-d '{"user_id": "u1", "metric": "exports", "quantity": 1}'| Endpoint | Method | Description |
|---|---|---|
/entitlements/plans | GET / POST | List or create subscription plans with features and quotas |
/entitlements/plans/:id | GET / PUT / DELETE | Manage a plan definition |
/entitlements/subscriptions | GET / POST | Assign a user or tenant to a plan |
/entitlements/check | POST | Check if a user has access to a named feature |
/entitlements/usage | POST | Record a usage event against a quota metric |
/entitlements/usage/:user_id | GET | Current quota usage and remaining limits for a user |
/entitlements/overages | GET | List users who have exceeded their quota in the current cycle |
Pair with nself-stripe to automatically update entitlements when a Stripe subscription changes. The Stripe plugin fires webhook events that trigger an entitlement sync — no polling required.
Pro Plugin — ɳSelf+ | v1.0.0