Architecture Evolution History
This document records the architectural decisions, structural transformations, and milestone evolutions of MetaPilot over time.
Architectural Timeline
Rendering diagram...
Architectural Eras
Era 1: Single-Tenant MVP (v0.1)
- Design: Basic Django WSGI server connected to a single database schema.
- Limitations: No multi-tenant data separation; manual Meta API token handling.
Era 2: Multi-Tenant & Role Hierarchy (v1.0)
- Evolution: Introduced 4-tier RBAC (,
SUPER_ADMIN,AGENCY_ADMIN,TENANT_ADMIN).TENANT_USER - Isolation: Tenant resolution via middleware, filtering objects by .
tenant_id
Era 3: Modular Monolith & Cryptography (v2.0)
- Evolution: Restructured single app into decoupled Django modules (,
users,tenants,campaigns, etc.).scheduler - Security: Added Fernet AES-256 encryption for storing Meta access tokens at rest.
- Asynchrony: Integrated Celery & Redis for mass broadcast job execution with Token Bucket rate limiting.
Era 4: Realtime ASGI & WebSockets (v3.0)
- Evolution: Replaced WSGI server with Daphne ASGI Server and Django Channels 4.0.
- Realtime Inbox: Live agent chat inbox over connected to Redis Channel Layer.
/ws/inbox/<tenant_id>/
Era 5: AI Engine & Vision Integration (v4.0)
- Evolution: Integrated OpenRouter API supporting text and vision models (StepFun 3.5 Flash and GPT-4o).
- Features: Dual AI capabilities — Platform Assistant for operators and WhatsApp AI Auto-responder for incoming customer messages.