AiR_Orchestrator

๐ท๐บ ะ ัััะบะฐั ะฒะตััะธั
air_orchestrator is the central backend service of the AiR platform. It provides HTTP/gRPC APIs, manages users, conversations, AI models and integrations, and coordinates communication channels and supporting microservices.
Features
- authentication, sessions, JWT, TOTP and access recovery;
- user, AI model, provider and conversation management;
- Telegram, WhatsApp, Avito and operator service integrations;
- Google OAuth, Calendar, Sheets and CRM integrations;
- MCP server with tools for AI models;
- realtime communication through WebSocket;
- internal gRPC API and voice-call proxy;
- MinIO/S3 file storage and Redis caching;
- Swagger/OpenAPI, Prometheus metrics and
pprofprofiling.
User Data Protection
Each user receives an individual MasterKey. It is protected by the user's password and encrypts API keys, channel settings, conversations, Google tokens, CRM configurations, embeddings and file-storage settings. This data can only be decrypted after the user authenticates in the system with their individual password. Even if the database is compromised or leaked, all user data remains inaccessible both to attackers and to the service administration.
System secrets and sensitive app_config values are encrypted with a separate application master key using AES-GCM. The key is loaded from APP_MASTER_KEY_FILE; transactional key rotation is supported through NEW_APP_MASTER_KEY_FILE and APP_CONFIG_REKEY.
Service dependency tree
air_orchestrator
โโโ air_db (MariaDB/MySQL)
โ โโโ users, conversations, configuration and encrypted data
โโโ air_redis (Redis)
โ โโโ sessions and user MasterKey cache
โโโ minio (S3 storage)
โ โโโ user files
โโโ envoy
โ โโโ HTTPS/gRPC-Web gateway and external traffic routing
โโโ air_tgbot
โโโ air_tguserbot
โโโ air_whatsbot
โโโ air_avito
โโโ air_operator
โโโ marusia_crm
โโโ air_payment
โโโ air_lead-hunter
build/air-mon.yml
โโโ cadvisor โโ Docker container metrics
build/air-vm.yml
โโโ victoriametrics โโ metrics collection and storage
build/air-vlogs.yml
โโโ victorialogs โโ logs collection and storage
build/air-vector.yml
โโโ vector โโ Docker container log collection into VictoriaLogs
build/air-perses.yml
โโโ perses โโ metrics and logs visualization
Project structure
.
โโโ build/ # Dockerfile, Makefile and compose files (dev.yml, prod.yml, air-*.yml)
โโโ cmd/ # application entry point
โโโ configs/ # .env and file-based secrets (secrets/ is not committed)
โโโ doc/ # OpenAPI contract
โโโ docs/ # generated Swagger files
โโโ envoy/ # Envoy gateway configuration (dev/prod)
โโโ internal/ # application code (delivery, usecase, repository, domain)
โโโ migrations/ # database migrations
โโโ monitoring/ # VictoriaMetrics, Vector and Perses configuration
Channel, CRM, payment and lead-hunting services communicate with the orchestrator through HTTP/gRPC contracts. The exact set of services depends on the deployment environment and Docker networks air_shared, app_internal and monitoring_shared.
Technologies
Go 1.25, Gin, gRPC, Protocol Buffers, WebSocket, MariaDB/MySQL, Redis, MinIO/S3, AES-GCM, JWT, TOTP, Google OAuth, MCP Streamable HTTP, Docker, Envoy, Swagger/OpenAPI, VictoriaMetrics, VictoriaLogs, Perses, Vector and cAdvisor.
Running
Create the external networks and prepare secrets:
docker network create air_shared
docker network create app_internal
docker network create monitoring_shared
Then copy configs/secrets.example/ to configs/secrets/ and fill in the values (see secrets example).
For development, from the build/ directory:
make up # infrastructure + dev application
make logs
make down
Equivalent compose invocation (run from build/):
docker compose --env-file ../configs/.env -f dev.yml up -d
Configuration lives in configs/ (.env + secrets/), build files in build/ (Dockerfile, compose files, Makefile). Use build/prod.yml for production. Secrets are mounted from configs/secrets/ and must not be committed.
Monitoring
build/air-vm.yml starts VictoriaMetrics, which collects orchestrator, related-service, container (cAdvisor via build/air-mon.yml) and MinIO metrics every 30 seconds. build/air-vlogs.yml stores logs, build/air-vector.yml collects Docker container logs through docker.sock and ships them to VictoriaLogs. Visualization is provided by Perses (build/air-perses.yml, UI at /perses/, dashboards provisioned from monitoring/perses). All containers use the json-file logging driver with rotation limited to one 10 MB file.
Documentation
- OpenAPI
- Calls gRPC contract
- VictoriaMetrics configuration
- Vector configuration
- Perses configuration and dashboards
- Docker build files (Dockerfile, Makefile, compose files)
Ecosystem marusia_ai
- air-common โ shared library for AI microservices
- air_orchestrator โ main orchestration service
- air_front โ Frontend react next.js dashboard for managing models, interaction channels, services...
- air_tgbot โ Telegram Bot operating in polling/webhook mode with delta streaming support
- air_tguserbot โ Telegram user bot capable of receiving and making voice calls
- air_whatsbot โ WhatsApp user bot without using the Graph API, capable of receiving and making voice calls
- air_widget โ chat widget for integration with any website
- air_avito โ bot for replying to Avito chats
- air_operator โ service for forwarding responses to and from an operator; the AI works for all bot types
- air_lead-hunter โ service for bots to find leads in Telegram and WhatsApp, including outgoing voice calls
- air_payment โ service for accepting cryptocurrency payments from users through Bybit
- marusia_crm โ integration service for external CRM systems
- air-logger โ auxiliary event-logging service with multi-user mode and Loki collector support
License
The project is distributed under the MIT license. It permits the free use, copying, modification and distribution of the software provided that the license text and copyright notices are retained.
The full license text is available in the LICENSE file.