Tenant Editions
Lager Guru offers three editions: FREE, PRO, and ENTERPRISE. Each tenant is assigned an edition that determines which modules and features are available.
Overview
The edition system controls:
- Module Access: Which modules are visible and accessible
- Feature Availability: Advanced features like AI, analytics, and automation
- Usage Limits: Maximum number of pick lists, zones, workers, and drivers
- API Access: Which API endpoints are available
Editions
FREE Edition
Target: Small operations, testing, or basic use cases
Included Modules:
- Basic dashboard
- Shipments management
- Driver management
- Basic settings
Limits:
- 10 pick lists
- 5 zones
- 3 workers
- 5 drivers
Use Cases:
- Small warehouses
- Testing environments
- Proof of concept
PRO Edition
Target: Growing businesses with standard warehouse operations
Included Modules:
- ✅ Inventory Management
- ✅ Pick & Pack
- ✅ Maintenance
- ✅ Safety & Compliance
- ✅ Equipment Tracking
- ✅ Auto Assignment
- ✅ Routing Engine
- ✅ System Settings
Excluded Modules:
- ❌ Floor Plan Visualization
- ❌ Slotting AI
Limits:
- 100 pick lists
- 50 zones
- 20 workers
- 30 drivers
Use Cases:
- Medium-sized warehouses
- Standard operations
- Multi-shift operations
ENTERPRISE Edition
Target: Large operations requiring advanced features and unlimited scale
Included Modules:
- ✅ All PRO modules
- ✅ Floor Plan Visualization
- ✅ Slotting AI
Limits:
- Unlimited (no restrictions)
Use Cases:
- Large warehouses
- Complex operations
- Advanced analytics needs
- Multi-warehouse setups
Module Matrix
| Module | FREE | PRO | ENTERPRISE |
|---|---|---|---|
| Dashboard | ✅ | ✅ | ✅ |
| Shipments | ✅ | ✅ | ✅ |
| Drivers | ✅ | ✅ | ✅ |
| Inventory | ❌ | ✅ | ✅ |
| Pick & Pack | ❌ | ✅ | ✅ |
| Floor Plan | ❌ | ❌ | ✅ |
| Slotting AI | ❌ | ❌ | ✅ |
| Maintenance | ❌ | ✅ | ✅ |
| Safety | ❌ | ✅ | ✅ |
| Equipment Tracking | ❌ | ✅ | ✅ |
| Auto Assignment | ❌ | ✅ | ✅ |
| Routing | ❌ | ✅ | ✅ |
| System Settings | ✅ (Basic) | ✅ | ✅ |
Edition Assignment
Default Behavior
- New tenants are assigned FREE edition by default
- Super-admins can change tenant editions at any time
- Edition changes take effect immediately
Assignment Process
- Super-admin navigates to
/admin→ Tenant Editions - Selects tenant from list
- Chooses edition from dropdown
- System updates immediately
- Audit log entry created
Checking Edition
In Code
typescript
import { getTenantEdition, hasModuleAccess } from '@/lib/editionResolver';
// Get tenant's edition
const edition = await getTenantEdition(tenantId);
// Returns: 'free' | 'pro' | 'enterprise'
// Check module access
const canAccess = await hasModuleAccess(tenantId, 'inventory');
// Returns: booleanIn UI
tsx
import { FeatureGate } from '@/components/FeatureGate';
<FeatureGate module="inventory">
<InventoryManagement />
</FeatureGate>In API
typescript
import { guardModuleAccess } from '@/lib/apiModuleGuard';
const error = await guardModuleAccess(tenantId, 'inventory');
if (error) {
return error; // Returns 403 JSON response
}Upgrading Tenants
Via Super-Admin UI
- Navigate to
/admin→ Tenant Editions - Find tenant in list
- Select new edition from dropdown
- Changes saved immediately
Via API
typescript
// Super-admin only
await supabase
.from('tenant_editions')
.upsert({
tenant_id: tenantId,
edition_id: editionId,
assigned_by: userId,
});Feature Gating
UI Components
Use <FeatureGate> to conditionally render components:
tsx
<FeatureGate module="inventory" showUpgradeMessage={true}>
<InventoryManagement />
</FeatureGate>Route Protection
Protect routes by checking access before rendering:
tsx
const { hasAccess } = useModuleAccess('inventory');
if (!hasAccess) {
return <ModuleUnavailable module="inventory" />;
}API Endpoints
Guard API endpoints in Edge Functions:
typescript
const guardResponse = await guardModuleAccess(tenantId, 'inventory');
if (guardResponse) {
return guardResponse; // 403 error
}Limits Enforcement
Checking Limits
typescript
import { checkLimit } from '@/lib/editionResolver';
const result = await checkLimit(tenantId, 'pickLists', currentCount);
if (!result.withinLimit) {
// Show upgrade message
console.log(result.message);
}Limit Types
- pickLists: Maximum pick lists per tenant
- zones: Maximum zones per tenant
- workers: Maximum workers per tenant
- drivers: Maximum drivers per tenant
Best Practices
- Always Check Access: Use
hasModuleAccess()before rendering UI or processing requests - Graceful Degradation: Show friendly messages instead of errors
- Default to FREE: New tenants start with FREE edition
- Audit Changes: All edition changes are logged
- No Breaking Changes: Edition system is additive only
Migration Path
From FREE to PRO
- Super-admin assigns PRO edition
- Tenant gains access to:
- Inventory Management
- Pick & Pack
- Maintenance
- Safety
- Equipment Tracking
- Auto Assignment
- Routing
From PRO to ENTERPRISE
- Super-admin assigns ENTERPRISE edition
- Tenant gains access to:
- Floor Plan Visualization
- Slotting AI
- All limits removed
API Reference
Edition resolver functions are available in lib/editionResolver.ts:
getTenantEdition(tenantId)- Get edition namehasModuleAccess(tenantId, module)- Check module accessrestrictModule(tenantId, module)- Get access status with messagegetAvailableModules(tenantId)- Get all available modulesgetEditionLimits(edition)- Get edition limitscheckLimit(tenantId, limitType, currentCount)- Check if within limit
Related Documentation
- Tenant Editions Management - Admin guide
- Multi-Tenant Architecture - Architecture overview