Product
Docs
Forum
Blog
Pricing
Contact
Log In
Sign Up
Docs
Getting Started
Introduction
License
Concepts
Architecture
Requirements
Installation
Releases
Upgrades
Configuration
Apps
CODE
Docs
Getting Started
Architecture
On this page
BxBaseModGeneralModule extends BxDolModule
BxBaseModGroupsModule extends BxBaseModProfileModule
BxBaseModNotificationsModule extends BxBaseModGeneralModule
BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolContentInfoService, iBxDolProfileService
BxBaseModTextModule extends BxBaseModGeneralModule implements iBxDolContentInfoService
bx_srv('module', 'method', [...])
// Declaring a service in a module class
public function serviceGetProfileInfo($iProfileId)
{
    // Implementation
    return $aProfileInfo;
}

// Calling the service from another module
$aProfileInfo = bx_srv('profiles', 'get_profile_info', [$iProfileId]);
bx_alert('type', 'action', $objectId, $profileId)
// Emitting an alert when a post is created
bx_alert('bx_posts', 'add', $iPostId, $iProfileId, [
    'content' => $sContent,
    'title' => $sTitle,
    'module' => $this->_oConfig->getName()
]);

// Handling an alert in a handler class
public function response($oAlert)
{
    if ($oAlert->sUnit == 'bx_posts' && $oAlert->sAction == 'add') {
        // Process the alert, e.g., send notification
        $iPostId = $oAlert->iObject;
        $iProfileId = $oAlert->iSender;
        $aExtraParams = $oAlert->aExtras;
        
        // Implementation
    }
}

Alert handlers are described in `sys_alerts` and `sys_alerts_handlers` DB tables.

### 6.3 Inheritance/Overrides

Developers can extend base classes or override templates in higher-priority directories to customize behavior without modifying core code. This approach allows for:

* Adding new functionality to existing modules
* Modifying the behavior of core components
* Customizing the appearance of templates
* Creating specialized versions of base classes

Example of class extension:

```php
// Extending a base module class
class BxCustomTextModule extends BxBaseModTextModule
{
    // Override a method to customize behavior
    public function serviceGetBlockView($aParams)
    {
        // Custom implementation
        $aResult = parent::serviceGetBlockView($aParams);
        
        // Modify the result
        $aResult['content'] = $this->_oTemplate->parseHtmlByName('custom_block.html', [
            'content' => $aResult['content'],
            'custom_field' => $this->_oDb->getCustomData()
        ]);
        
        return $aResult;
    }
}

### 6.4 UNA REST API

The same service calls are exposed externally via OAuth2/API keys, enabling seamless integration with:
* Mobile applications
* CRM systems
* External user interfaces
* Third-party services

Example REST API call:

Response format:

```json
{
    "code": 0,
    "message": "Success",
    "data": {
        "key1": "value1",
        "key2": "value2",
        "items": [
            {"id": 1, "title": "Item 1"},
            {"id": 2, "title": "Item 2"}
        ]
    }
}
6w
On this page
1. Introduction2. High-Level Architecture2.1 Request Handling Flow3. Core Components3.1 Core3.2 Objects3.3 Plugins3.4 Modules4. MVC Paradigm5. Accounts and Profiles SystemAccount Structure (sys_accounts DB table):Profile Structure (sys_profiles DB table):5.1 Accounts (BxDolAccount)5.2 Profiles (BxDolProfile)6. Internal APIs & Extensibility Hooks6.1 Service Calls6.2 Alerts (Hooks)6.4 UNA REST API7. Cloud Deployment & Load Balancing7.1 Docker/Containerization7.2 Load Balancing7.3 Caching Strategy7.4 Autoscaling & Monitoring8. Security Considerations8.1 Roles & Permissions8.2 CSRF & XSS Prevention8.3 SQL Injection Defense8.4 HTTPS Everywhere8.5 File Security8.6 2FA & SSO8.7 Auditing & Logging9. Developer Workflow & Best Practices9.1 No-Code in Studio9.2 Module Creation9.3 Test & Staging9.4 Version Control9.5 Keep Updated10. Conclusion
Auto
BxBaseModGeneralModule extends BxDolModule
BxBaseModGroupsModule extends BxBaseModProfileModule
BxBaseModNotificationsModule extends BxBaseModGeneralModule
BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolContentInfoService, iBxDolProfileService
BxBaseModTextModule extends BxBaseModGeneralModule implements iBxDolContentInfoService
// Declaring a service in a module class
public function serviceGetProfileInfo($iProfileId)
{
    // Implementation
    return $aProfileInfo;
}

// Calling the service from another module
$aProfileInfo = bx_srv('profiles', 'get_profile_info', [$iProfileId]);
// Emitting an alert when a post is created
bx_alert('bx_posts', 'add', $iPostId, $iProfileId, [
    'content' => $sContent,
    'title' => $sTitle,
    'module' => $this->_oConfig->getName()
]);

// Handling an alert in a handler class
public function response($oAlert)
{
    if ($oAlert->sUnit == 'bx_posts' && $oAlert->sAction == 'add') {
        // Process the alert, e.g., send notification
        $iPostId = $oAlert->iObject;
        $iProfileId = $oAlert->iSender;
        $aExtraParams = $oAlert->aExtras;
        
        // Implementation
    }
}

Alert handlers are described in `sys_alerts` and `sys_alerts_handlers` DB tables.

### 6.3 Inheritance/Overrides

Developers can extend base classes or override templates in higher-priority directories to customize behavior without modifying core code. This approach allows for:

* Adding new functionality to existing modules
* Modifying the behavior of core components
* Customizing the appearance of templates
* Creating specialized versions of base classes

Example of class extension:

```php
// Extending a base module class
class BxCustomTextModule extends BxBaseModTextModule
{
    // Override a method to customize behavior
    public function serviceGetBlockView($aParams)
    {
        // Custom implementation
        $aResult = parent::serviceGetBlockView($aParams);
        
        // Modify the result
        $aResult['content'] = $this->_oTemplate->parseHtmlByName('custom_block.html', [
            'content' => $aResult['content'],
            'custom_field' => $this->_oDb->getCustomData()
        ]);
        
        return $aResult;
    }
}

### 6.4 UNA REST API

The same service calls are exposed externally via OAuth2/API keys, enabling seamless integration with:
* Mobile applications
* CRM systems
* External user interfaces
* Third-party services

Example REST API call: