EvaBot Online โ Architecture
Last Updated: 2026-09-07
Version: v0.0.2
๐๏ธ System Overview
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ EVABOT ONLINE ECOSYSTEM โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ User Browser Public IP Google Cloud โ
โ โโโโโโโโโโโ โโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Web UI โ โHTTPSโ> โ EvaFaceโ โHTTPSโ> โ EvaBrain โ โ
โ โ TUI โ โ 443 โ โ :3000 โ โ
โ โโโโโโโโโโโ โโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โ โ โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Caddy (Iowa) โ โโโโโโ> โ Node.js โ โ
โ โ TLS 1.3 โ Wg โ EvaBot Brain โ โ
โ โ HTTP/3 QUIC โ <โโโโโ โ Frankfurt โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โ โ โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Tailscale โ โ Google AI โ โ
โ โ 100.125.200.49โ โ Gemini 2.5 โ โ
โ โโโโโโโโโโโโโโโโ โ Claude 3.7 โ โ
โ โ GPT-4o โ โ
โ โ DeepSeek R1 โ โ
โ โ Llama 3.3 โ โ
โ โ 78 models... โ โ
โ โโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฅ๏ธ Components
1. EvaFace (Edge Gateway) - Iowa
VM: evaline-micro-vm
Type: e2-micro (2 vCPU, 1 GB RAM)
Region: us-central1-a
Cost: $0.00/mo (Always Free Tier)
Role:
- TLS termination (Caddy 2.11)
- HTTP/3 QUIC support
- Reverse proxy to EvaBrain
- Static file serving
- Domain management
Domains:
evabot.onlineevaline.onlineevaline.networkevaline.website
Software:
- Caddy 2.11
- Linux 6.12 (Debian 13 Trixie)
- Tailscale daemon
2. EvaBrain (Compute Core) - Frankfurt
VM: evabot-agent-vm
Type: c3-standard-8 (8 vCPU, 32 GB RAM)
Region: europe-west3-a
Cost: ~$357.80/mo (on-demand)
Role:
- LLM orchestration
- Multi-agent deliberation (Consilium)
- Knowledge Base server
- API backend
- WebSocket server (planned)
Software:
- Node.js 22
- TypeScript 5.7
- esbuild
- Google AI SDK
- LiteLLM (OmniRoute)
- Tailscale daemon
3. WireGuard Mesh
Network: Tailscale 100.x
Encryption: ChaCha20-Poly1305
Latency: ~120ms (Frankfurt โ Iowa)
Tunnels:
100.66.98.4(Frankfurt)100.125.200.49(Iowa)
๐ Code Architecture
Monorepo Structure
evabot-online/ # GitHub: evaline-network/evabot-online
โโโ src/ # TypeScript source (11,272 lines)
โ โโโ server/ # HTTP server
โ โ โโโ server.ts # 211 lines - main entry
โ โ โโโ routes/ # 7 modular routers
โ โ โโโ Router.ts # Base Router class
โ โ โโโ ChatRouter.ts # /api/chat, /api/chat/stream, /api/consilium
โ โ โโโ ModelsRouter.ts # /api/models/* (6 endpoints)
โ โ โโโ KbRouter.ts # /api/kb/* (5 endpoints)
โ โ โโโ LogsRouter.ts # /api/logs/* (3 endpoints)
โ โ โโโ SecurityRouter.ts # /api/security/* (4 endpoints)
โ โ โโโ AlertsRouter.ts # /api/alerts/* (5 endpoints)
โ โโโ core/ # Business logic
โ โ โโโ Logger.ts # 12 categories, 3 files
โ โ โโโ Security.ts # IP blocking, rate limiting
โ โ โโโ AlertManager.ts # 6 channels, 4 severities
โ โ โโโ KnowledgeBase.ts # 182 documents
โ โ โโโ KnowledgeBaseCommand.ts # /kb command
โ โ โโโ ConsiliumEngine.ts # Multi-agent deliberation
โ โ โโโ UniversalLlmClient.ts # Multi-provider chat
โ โ โโโ GeminiClient.ts # Google Gemini
โ โ โโโ GoogleAuthProvider.ts # ADC authentication
โ โ โโโ ChatSession.ts # Session management
โ โ โโโ ClusterMonitor.ts # GCP node monitoring
โ โ โโโ BootDiagnostics.ts # Startup checks
โ โ โโโ Config.ts # Configuration
โ โ โโโ TuiRenderer.ts # Terminal UI
โ โ โโโ AnsiStreamEngine.ts # Streaming TUI
โ โ โโโ LocalePolicy.ts # i18n rules
โ โ โโโ CorporateRoles.ts # 8 personas
โ โ โโโ ...
โ โโโ models/ # Model registry
โ โ โโโ ModelRegistry.ts # 78 models catalog
โ โ โโโ ModelRatings.ts # Quality/Speed/Context/Cost ratings
โ โโโ web/ # Frontend TypeScript
โ โ โโโ app.ts # Web UI
โ โโโ cli/ # CLI
โ โ โโโ terminal-chat.ts # TUI client
โ โโโ index.ts # Public API exports
โโโ public/ # Static files (HTML/CSS/JS)
โโโ knowledge-base/ # EvaLine KB (182 docs, 19MB)
โโโ config/ # Caddy, fail2ban
โโโ .github/workflows/ # CI/CD
โโโ docs/ # Technical docs
โโโ dist/ # Build output (gitignored)
Router Pattern
Each router is self-contained:
// ModelsRouter.ts
export function createModelsRouter(): Router {
const router = new Router();
router.get('/api/models', withErrorHandling(async (ctx) => {
// Handler logic
}));
return router;
}Benefits:
- Modular (each file < 100 lines)
- Testable (independent)
- Hot-reloadable
- Type-safe (TypeScript)
๐ API Architecture
REST API (30+ endpoints)
| Category | Endpoints | Router |
|---|---|---|
| System | /health, /roles, /logs, /worklog/* | server.ts + LogsRouter |
| Models | /models, /models/free, /models/paid, /models/top, /models/command | ModelsRouter |
| Chat | /chat, /chat/stream, /consilium | ChatRouter |
| Knowledge Base | /kb/status, /kb/search, /kb/list, /kb/backend, /kb/command | KbRouter |
| Security | /security/status, /security/report, /security/block, /security/unblock | SecurityRouter |
| Alerts | /alerts, /alerts/stats, /alerts/send, /alerts/channel, /alerts/config | AlertsRouter |
Request Flow
1. HTTP request arrives at EvaFace (Caddy)
2. TLS termination (Caddy)
3. Security middleware:
- Check blocked IPs
- Apply rate limiting
- Detect suspicious paths
4. Route to EvaBrain (via WireGuard)
5. EvaBrain matches route in Router
6. withErrorHandling wrapper catches exceptions
7. Route handler executes
8. Response streamed back
9. HTTP request logged with IP, duration
๐ค AI Model Architecture
Multi-Provider Strategy
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ UniversalLlmClient โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ resolveProvider(modelId) โ โ
โ โ โ google | omniroute | openrouter โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
โ Google โ โOmniRoute โ โOpenRouterโ
โ Gemini โ โLiteLLM โ โ API โ
โ via โ โ Proxy โ โ โ
โ ADC โ โ :20128 โ โ โ
โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
Model Registry
- 78 models across 12 categories
- 46 free (zero cost, quotas)
- 32 paid (PAYG, USD/EUR pricing)
- 6 tiers: Free Quota+Paid, Vertex AI, Open Weights, Free Community, OmniRoute, OpenCode
Rating System
- Quality (40%): based on model name and category
- Speed (25%): based on RPM quota and model type
- Context (20%): based on context window size
- Cost (15%): based on input price
๐ Knowledge Base Architecture
Data Flow
knowledge-base/evaline-com-ua/
โโโ README.{en,ru,uk}.md
โโโ REPORT.{en,ru,uk}.md
โโโ site/
โโโ en/ (b2b/, b2c/, about.md, etc.)
โโโ uk/
โโโ ru/
โโโ pl/
โโโ ro/
โโโ de/
โ (loaded on startup)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ KnowledgeBase.initialize() โ
โ โ โ
โ 182 documents in memory โ
โ โ โ
โ search(query) โ top-5 results โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Search Algorithm
- Keyword matching with frequency scoring
- Title boost (+0.5)
- Tag boost (+0.2 per tag)
- Score:
min(0.99, 0.55 + (matches/tokens) * 0.44)
Future: Vector Search (v0.1.0)
- Embedding model: Gemini embedding-004
- Vector DB: ChromaDB
- Semantic search instead of keyword
๐ก๏ธ Security Architecture
Defense in Depth
Layer 1: Network (GCP Firewall)
โ
Layer 2: TLS (Caddy)
โ
Layer 3: WireGuard Mesh (private network)
โ
Layer 4: Rate Limiting (EvaBrain)
โ
Layer 5: IP Blocking (in-memory)
โ
Layer 6: Path Pattern Detection (17 regex)
โ
Layer 7: Auto-Block (after 20 suspicious)
โ
Layer 8: fail2ban (planned)
โ
Layer 9: Cloud Armor (planned for v0.5.0)
Alerting Flow
Suspicious Activity
โ
Security.recordSuspicious()
โ
Security.checkRateLimit() โ BLOCK
โ
AlertManager.high('IP Auto-Blocked')
โ
Channels:
- Console (red blink)
- File (logs/alerts.log)
- Webhook (Slack/Discord/n8n)
- Email (SMTP)
- Syslog (UDP 514)
๐ Observability Architecture
Logging Pipeline
App Event
โ
Logger.write(category, tag, message)
โ
โโโ console (with colors)
โโโ evabot.log (all events)
โโโ user-actions-{date}.log (USER category)
โโโ errors-{date}.log (ERROR level)
โโโ in-memory buffer (1000 entries)
โ
/api/logs/recent endpoint
Metrics
- HTTP request rate
- Response time (p50, p95, p99)
- Error rate by endpoint
- Model usage by provider
- KB search queries
- Security events per hour
Planned (v0.5.0)
- Prometheus exporter
- Grafana dashboards
- OpenTelemetry tracing
๐ Deployment Architecture
CI/CD Pipeline
GitHub Push (main branch)
โ
GitHub Actions
โโ Test (npm test)
โโ Build (npm run build)
โโ Deploy to EvaBrain (Frankfurt)
โ โโ gcloud compute ssh evabot-agent-vm
โ โโ git pull && npm install && npm run build
โ โโ systemctl restart evabot-brain
โโ Deploy to EvaFace (Iowa)
โโ gcloud compute ssh evaline-micro-vm
โโ git pull && rsync to /var/www/evabot.online
โโ systemctl reload caddy
Manual Deploy
./deploy-sync.sh "commit message"
# = build + commit + push + sync to GCP๐ฎ Future Architecture (v1.0.0)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Multi-Region Active-Active โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ EU-WEST3 โ โ US-CENT1 โ โ ASIA-1 โ โ ASIA-2 โ โ
โ โ Frankfurtโ โ Iowa โ โ Singaporeโ โ Tokyo โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Global Load Balancer (Cloudflare) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Microservices: โ โ
โ โ - chat-service - kb-service โ โ
โ โ - model-router - security-service โ โ
โ โ - alert-service - analytics-service โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Data Layer: โ โ
โ โ - PostgreSQL (pgvector) - ChromaDB cluster โ โ
โ โ - Redis (cache) - S3 (KB storage) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Last Review: 2026-09-07
Next Review: After v0.1.0 release