feat: Implement user tier-based feature gating system #18

Merged
egullickson merged 1 commits from issue-8-tier-gating into main 2026-01-04 20:52:02 +00:00
Owner

Summary

  • Implement subscription tier system (Free/Pro/Enterprise) to gate premium features
  • Gate "Scan for Maintenance Schedule" checkbox behind Pro tier
  • Add reusable infrastructure for adding new gated features

Changes

Backend

  • Create feature-tiers.ts with FEATURE_TIERS config and tier utilities
  • Add /api/config/feature-tiers endpoint for frontend config sync
  • Create requireTier middleware for route-level tier enforcement
  • Add subscriptionTier to request.userContext in auth plugin
  • Gate scanForMaintenance in documents controller (returns 403 for free users)
  • Add data migration to reset scanForMaintenance for existing free users

Frontend

  • Create useTierAccess hook for checking feature access
  • Create UpgradeRequiredDialog component (mobile + desktop responsive)
  • Gate DocumentForm checkbox with lock icon for free users
  • Add SubscriptionTier type to profile types

Documentation

  • Add comprehensive docs/TIER-GATING.md usage guide

Test plan

  • 30 unit tests pass (feature-tiers, tier-guard, controller tier validation)
  • Free user sees disabled checkbox with lock icon on document form
  • Clicking lock icon opens UpgradeRequiredDialog
  • Pro/Enterprise user sees normal checkbox
  • Backend returns 403 if free user bypasses frontend and sends scanForMaintenance=true
  • Admin can change user tier from Admin UI

Closes #8

🤖 Generated with Claude Code

## Summary - Implement subscription tier system (Free/Pro/Enterprise) to gate premium features - Gate "Scan for Maintenance Schedule" checkbox behind Pro tier - Add reusable infrastructure for adding new gated features ## Changes ### Backend - Create `feature-tiers.ts` with FEATURE_TIERS config and tier utilities - Add `/api/config/feature-tiers` endpoint for frontend config sync - Create `requireTier` middleware for route-level tier enforcement - Add `subscriptionTier` to `request.userContext` in auth plugin - Gate scanForMaintenance in documents controller (returns 403 for free users) - Add data migration to reset scanForMaintenance for existing free users ### Frontend - Create `useTierAccess` hook for checking feature access - Create `UpgradeRequiredDialog` component (mobile + desktop responsive) - Gate DocumentForm checkbox with lock icon for free users - Add `SubscriptionTier` type to profile types ### Documentation - Add comprehensive `docs/TIER-GATING.md` usage guide ## Test plan - [x] 30 unit tests pass (feature-tiers, tier-guard, controller tier validation) - [ ] Free user sees disabled checkbox with lock icon on document form - [ ] Clicking lock icon opens UpgradeRequiredDialog - [ ] Pro/Enterprise user sees normal checkbox - [ ] Backend returns 403 if free user bypasses frontend and sends scanForMaintenance=true - [ ] Admin can change user tier from Admin UI ## Related Issues Closes #8 🤖 Generated with [Claude Code](https://claude.com/claude-code)
egullickson added 1 commit 2026-01-04 20:35:13 +00:00
feat: Implement user tier-based feature gating system (refs #8)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 4m35s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 27s
Deploy to Staging / Verify Staging (pull_request) Successful in 5s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 5s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
f494f77150
Add subscription tier system to gate features behind Free/Pro/Enterprise tiers.

Backend:
- Create feature-tiers.ts with FEATURE_TIERS config and utilities
- Add /api/config/feature-tiers endpoint for frontend config fetch
- Create requireTier middleware for route-level tier enforcement
- Add subscriptionTier to request.userContext in auth plugin
- Gate scanForMaintenance in documents controller (Pro+ required)
- Add migration to reset scanForMaintenance for free users

Frontend:
- Create useTierAccess hook for tier checking
- Create UpgradeRequiredDialog component (responsive)
- Gate DocumentForm checkbox with lock icon for free users
- Add SubscriptionTier type to profile.types.ts

Documentation:
- Add TIER-GATING.md with usage guide

Tests: 30 passing (feature-tiers, tier-guard, controller)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
egullickson merged commit a771aacf29 into main 2026-01-04 20:52:02 +00:00
egullickson deleted branch issue-8-tier-gating 2026-01-04 20:52:02 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#18