feat: implement modular platform architecture (Phase 1)
Add module system for enabling/disabling feature bundles per platform. Module System: - ModuleDefinition dataclass for defining modules - 12 modules: core, platform-admin, billing, inventory, orders, marketplace, customers, cms, analytics, messaging, dev-tools, monitoring - Core modules (core, platform-admin) cannot be disabled - Module dependencies (e.g., marketplace requires inventory) MenuService Integration: - Menu items filtered by module enablement - MenuItemConfig includes is_module_enabled and module_code fields - Module-disabled items hidden from sidebar Platform Configuration: - BasePlatformConfig.enabled_modules property - OMS: all modules enabled (full commerce) - Loyalty: focused subset (no billing/inventory/orders/marketplace) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
47
app/modules/__init__.py
Normal file
47
app/modules/__init__.py
Normal file
@@ -0,0 +1,47 @@
|
||||
# app/modules/__init__.py
|
||||
"""
|
||||
Modular Platform Architecture.
|
||||
|
||||
This package provides a module system for enabling/disabling feature bundles per platform.
|
||||
|
||||
Module Hierarchy:
|
||||
Global (SaaS Provider)
|
||||
└── Platform (Business Product - OMS, Loyalty, etc.)
|
||||
└── Modules (Enabled features - Billing, Marketplace, Inventory, etc.)
|
||||
├── Routes (API + Page routes)
|
||||
├── Services (Business logic)
|
||||
├── Menu Items (Sidebar entries)
|
||||
└── Templates (UI components)
|
||||
|
||||
Modules vs Features:
|
||||
- Features: Granular capabilities (e.g., analytics_dashboard, letzshop_sync)
|
||||
Assigned to subscription tiers, gated at API route level.
|
||||
- Modules: Cohesive feature bundles (e.g., billing, marketplace, inventory)
|
||||
Enabled/disabled per platform, contains multiple features and menu items.
|
||||
|
||||
Usage:
|
||||
from app.modules import module_service
|
||||
from app.modules.base import ModuleDefinition
|
||||
from app.modules.registry import MODULES
|
||||
|
||||
# Check if module is enabled for platform
|
||||
if module_service.is_module_enabled(platform_id, "billing"):
|
||||
...
|
||||
|
||||
# Get menu items for enabled modules
|
||||
menu_items = module_service.get_module_menu_items(platform_id, FrontendType.ADMIN)
|
||||
|
||||
# Get all enabled modules for platform
|
||||
modules = module_service.get_platform_modules(platform_id)
|
||||
"""
|
||||
|
||||
from app.modules.base import ModuleDefinition
|
||||
from app.modules.registry import MODULES
|
||||
from app.modules.service import ModuleService, module_service
|
||||
|
||||
__all__ = [
|
||||
"ModuleDefinition",
|
||||
"MODULES",
|
||||
"ModuleService",
|
||||
"module_service",
|
||||
]
|
||||
Reference in New Issue
Block a user