Middleware for 1C-Bitrix Integration: Development & Implementation
A website on Bitrix24, an accounting system in 1C, a CRM, and a warehouse management system—each pair requires its own integration. Six bidirectional links, six points of failure. An API change in one system breaks the rest. Each manual fix costs 20,000–40,000 RUB. We have encountered such scenarios many times and know how to radically simplify the architecture.
Middleware is a universal intermediary layer that receives data from any source, transforms it according to defined rules, and delivers it to the target system. Both systems only know about the middleware, not each other. This drastically reduces the number of failure points and makes each integration independent.
How Middleware Solves the Tight Coupling Problem
Middleware is an event bus through which all messages pass. Instead of "each-to-each" connections, you get a single entry point for all systems. Our experience: over 50 integration projects, with an average 70% reduction in failure points. Cost savings on maintenance — 200,000–300,000 RUB per year.
When Do You Need Middleware and Why Is It Better Than Direct Integration?
Direct integration is a tight coupling: change a schema in 1C — you have to rewrite the connector in Bitrix. Middleware isolates changes: only the connector to the system that changed needs updating. Modification time is reduced by a factor of 3–5. Middleware is essential with three or more systems, complex transformations, buffering needs, and full audit requirements.
Architecture and Implementation of Middleware
Option 1. PHP middleware inside Bitrix — a separate module in /local/modules/, receives requests via HTTP, transforms, proxies. Downside: tied to Bitrix infrastructure.
Option 2. Independent microservice (Node.js, Python FastAPI, Go) — lives separately, Bitrix is one of the sources/destinations. Advantage: scales independently, does not consume PHP resources.
Option 3. iPaaS platforms — Make (Integromat), n8n, Apache Camel. Visual building of transformations without code. Suitable for non-developers but limited with complex transformations.
PHP Middleware: Structure and Contracts
// Central middleware router class IntegrationBus { private array $handlers = []; public function register(string $eventType, callable $handler): void { $this->handlers[$eventType][] = $handler; } public function dispatch(string $eventType, array $payload): array { $results = []; foreach ($this->handlers[$eventType] ?? [] as $handler) { try { $results[] = $handler($payload); } catch (\Throwable $e) { $this->logError($eventType, $payload, $e); $results[] = ['error' => $e->getMessage()]; } } return $results; } } // Register handlers in init.php $bus = IntegrationBus::getInstance(); // Order from site → CRM and accounting system $bus->register('order.created', [CrmConnector::class, 'handleNewOrder']); $bus->register('order.created', [AccountingConnector::class, 'createInvoice']); $bus->register('order.created', [WarehouseConnector::class, 'reserveGoods']); Data Transformation (Mapping)
Transformation is the most complex part of middleware. We use the Pipeline pattern:
class TransformationPipeline { private array $pipes = []; public function pipe(callable $transformation): self { $this->pipes[] = $transformation; return $this; } public function process(array $data): array { return array_reduce( $this->pipes, fn($carry, $pipe) => $pipe($carry), $data ); } } // Example: Bitrix order → SAP format $pipeline = (new TransformationPipeline()) ->pipe(fn($d) => normalizeCustomerData($d)) // normalize customer ->pipe(fn($d) => enrichWithFiasData($d)) // add FIAS by address ->pipe(fn($d) => convertCurrencyFields($d)) // currency conversion ->pipe(fn($d) => mapStatusCodes($d, 'bitrix2sap')) // status mapping ->pipe(fn($d) => validateSapSchema($d)); // SAP schema validation Audit and Reproducibility
Every message is logged before and after transformation:
-- Audit table CREATE TABLE integration_audit ( id BIGSERIAL PRIMARY KEY, event_type VARCHAR(100), source_system VARCHAR(50), target_system VARCHAR(50), payload_in JSONB, payload_out JSONB, status VARCHAR(20), -- success, error, retry error_msg TEXT, duration_ms INT, created_at TIMESTAMP DEFAULT NOW() ); On error in a downstream system, we replay the operation by audit record ID without resending the request to the source.
Case Study: Manufacturing Company
Three-way integration — a manufacturing enterprise
Scenario: 1C:ERP (stock and prices) ↔ Bitrix site ↔ RetailCRM (order processing). Without middleware, each pair had its own integration — six bidirectional links, six failure points. After introducing a middleware hub: 3 systems → 3 connectors to middleware. A change in the 1C API only affected the 1C connector, not the RetailCRM integration. The company saved about 40 development hours per change.
What's Included in Middleware Development?
On each project we deliver a complete set of results:
- Architectural documentation and contract descriptions
- Middleware source code with comments
- Access to repository and development server
- Deployment and configuration instructions
- Training for your team on middleware usage
- 6-month support after delivery
Process, Timelines, and Cost Estimation
We work in several stages:
- Analysis — interviews with teams, studying system APIs. Result: data schema, contracts.
- Design — architecture selection (PHP, microservice, iPaaS). Result: architectural documentation.
- Core development — event bus, transformation pipeline, audit. Result: working middleware.
- Connectors — one per system (1C, Bitrix, CRM, etc.). Result: documented connectors.
- Testing — integration tests, load testing. Result: test protocol.
- Deployment and support — monitoring setup, alerts, backups. Result: SLA, 6-month code warranty.
Indicative development timelines:
| Integration scope | Timeline |
|---|---|
| 2–3 systems, simple transformations | from 2 weeks |
| 3–5 systems, complex mappings | from 1 month |
| 5+ systems, non-standard protocols | from 2 months |
Exact estimates are given after a free audit of your infrastructure. Get a consultation for your project — our engineers will help determine if you need middleware and choose the optimal solution. Contact us for an audit.
Order an integration audit today—we will analyze your current architecture and propose options. Our team consists of certified Bitrix specialists with 10+ years of experience.
Middleware definition according to Wikipedia

