Skip to content

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

ModuleFREEPROENTERPRISE
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

  1. Super-admin navigates to /admin → Tenant Editions
  2. Selects tenant from list
  3. Chooses edition from dropdown
  4. System updates immediately
  5. 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: boolean

In 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

  1. Navigate to /admin → Tenant Editions
  2. Find tenant in list
  3. Select new edition from dropdown
  4. 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

  1. Always Check Access: Use hasModuleAccess() before rendering UI or processing requests
  2. Graceful Degradation: Show friendly messages instead of errors
  3. Default to FREE: New tenants start with FREE edition
  4. Audit Changes: All edition changes are logged
  5. No Breaking Changes: Edition system is additive only

Migration Path

From FREE to PRO

  1. Super-admin assigns PRO edition
  2. Tenant gains access to:
    • Inventory Management
    • Pick & Pack
    • Maintenance
    • Safety
    • Equipment Tracking
    • Auto Assignment
    • Routing

From PRO to ENTERPRISE

  1. Super-admin assigns ENTERPRISE edition
  2. Tenant gains access to:
    • Floor Plan Visualization
    • Slotting AI
  3. All limits removed

API Reference

Edition resolver functions are available in lib/editionResolver.ts:

  • getTenantEdition(tenantId) - Get edition name
  • hasModuleAccess(tenantId, module) - Check module access
  • restrictModule(tenantId, module) - Get access status with message
  • getAvailableModules(tenantId) - Get all available modules
  • getEditionLimits(edition) - Get edition limits
  • checkLimit(tenantId, limitType, currentCount) - Check if within limit

Released under Commercial License