Platform Architecture Overview
This document provides a technical overview of the AIOHM Platform's architecture, core components, and design principles.
🏗️ Core Architecture
The AIOHM Platform is built on a modern, robust technology stack designed for scalability and maintainability.
- Framework: The application is built on Laravel 12, leveraging its powerful features for routing, ORM (Eloquent), and dependency injection.
- Admin Panel: The entire administrative interface is powered by Filament 3.2, providing a rich, reactive, and highly extensible user experience. All admin panel code resides in the
app/Filamentdirectory. - Multi-Tenancy: The platform uses the
stancl/tenancypackage to provide a multi-database tenancy model. Each tenant (or "Brand") has a completely isolated database and file storage (storage/tenants/{tenant_id}), ensuring strict data privacy and security.
Domain-Driven Design (DDD)
The application's business logic is organized into distinct Domains located in the app/Domains directory. This approach keeps related logic cohesive and decoupled from other parts of the application. The primary domains are:
AI: Contains all logic related to AI agents, the M.U.S.E. system, and communication with language models.Commerce: Handles e-commerce functionality, including payments via Laravel Cashier.Marketing: Manages marketing automation, campaigns, and lead generation.Social: Contains logic for social media integrations like Postiz.
Service Layer
Complex business logic and interactions with third-party services are encapsulated within Service Classes located in app/Services. This keeps controllers thin and logic reusable. Key examples include WordPressApiService, LeadDiscoveryService, and TenantAiConfigManager.
Super Admin Configuration
The platform utilizes a dynamic configuration for its super administrator.
- The ID of the tenant designated as the "super admin" is defined in
config/tenants.phpunder thesuper_admin_tenantkey. - A user with the
adminrole who belongs to this configured tenant is granted platform-wide administrative privileges, as defined in theisPlatformAdmin()method of theapp/Models/User.phpmodel.
📂 Directory Structure
| Directory | Description |
|---|---|
app/ | Core application code, including Models, Services, Domains, and Filament resources. |
config/ | All application configuration files (database, services, tenants.php, etc.). |
database/ | Database migrations, seeders, and factories. |
docs/ | VitePress documentation source files. |
public/ | The web server's document root and compiled frontend assets. |
resources/ | Raw, uncompiled assets like CSS, JavaScript, and Blade views. |
routes/ | All HTTP and console route definitions. |
storage/ | Logs, file uploads, and cached data. Tenant-specific files are in storage/tenants/. |
✨ Key Systems Deep Dive
The M.U.S.E. AI System
- M.U.S.E. (Multi-faceted Understanding and Synthesis Engine) is the codename for the platform's core AI functionality.
- Its configuration is managed in
config/muse.php, which controls settings like data retention and summarization providers. - It includes an AI Failsafe System that automatically switches between providers (Gemini, Groq, etc.) in case of errors or rate limits.
Model Context Protocol (MCP)
- MCP is a standardized communication layer for AI agents to interact with tools and services.
- MCP server endpoints are defined in
routes/ai.php. - This architecture allows new tools (like WordPress or Mautic integration) to be exposed to AI agents in a structured way.
Diagram
graph TD;
subgraph "User Interaction"
A[Browser] -->|HTTP Request| B[Web Server];
end
subgraph "Laravel Application"
B --> C[Router];
C -- "Routes Files" --> D[web.php, api.php, tenant.php];
subgraph "Core Logic (app/)"
G[Middleware]
H[Controllers]
I[Services]
J[Domains]
K[Models]
end
D --> G --> H;
H --> I;
H --> J;
I --> J;
J --> K;
K --> L[Database];
end
subgraph "Admin Panel"
M[Filament PanelProvider] -->|Defines Admin UI| H;
end
subgraph "Database Layer"
L -- "stancl/tenancy" --> N[Central DB (users, tenants)];
L -- "stancl/tenancy" --> O[Tenant DBs (app data)];
end