ruflo/docs/adr/ADR-001-EXTENSION-ARCHITECTURE.md
Status: Implemented Date: 2026-01-10 Updated: 2026-01-12 Author: Conveyor AI Team Deciders: Engineering, Product, DevOps Related: ADR-002-WASM-CORE-PACKAGE, ADR-011-cloud-run-extension-architecture, ADR-012-vitejs-heroui-frontend-stack, ADR-013-hybrid-data-layer-architecture
Conveyor AI requires modular extensions to serve different business domains within the organization. As the platform grows to support multiple operational areas, we need an architecture that:
The monolithic approach would not scale well as different teams require specialized functionality with varying update cycles and performance requirements.
Adopt a Domain-Driven Design (DDD) approach with a constellation of 6 independent extensions, each deployed as a separate Cloud Run service while sharing common packages.
| Extension | Priority | Domain | Primary Users |
|---|---|---|---|
| Sales Pipeline | P0 | Sales Operations | Sales Team, Account Managers |
| Financial Operations | P0 | Finance & Accounting | Finance Team, Controllers |
| HR/Compensation | P1 | Human Resources | HR Team, Managers |
| Compliance/Legal | P1 | Legal & Compliance | Legal Team, Compliance Officers |
| Customer Success | P2 | Customer Relationships | CSMs, Support Team |
| Revenue Operations | P2 | Revenue Analytics | RevOps, Leadership |
+-------------------------------------------------------------------------+
| CONVEYOR AI EXTENSION CONSTELLATION |
+-------------------------------------------------------------------------+
| |
| +------------------+ +------------------+ +------------------+ |
| | Sales Pipeline | | Financial Ops | | HR/Compensation | |
| | (P0) | | (P0) | | (P1) | |
| | | | | | | |
| | - Deal Tracking | | - Transactions | | - Comp Planning | |
| | - Pipeline Mgmt | | - Invoicing | | - Commission Calc| |
| | - Forecasting | | - Budget Control | | - Quota Tracking | |
| | - Lead Scoring | | - Cash Flow | | - Performance | |
| +--------+---------+ +--------+---------+ +--------+---------+ |
| | | | |
| +--------+---------+ +--------+---------+ +--------+---------+ |
| | Compliance/Legal | | Customer Success | | Revenue Ops | |
| | (P1) | | (P2) | | (P2) | |
| | | | | | | |
| | - Risk Scoring | | - Health Scores | | - ARR Analysis | |
| | - Contract Mgmt | | - Churn Predict | | - Forecasting | |
| | - Audit Trail | | - Usage Metrics | | - KPI Dashboard | |
| | - Compliance Chk | | - NPS Tracking | | - Cohort Analysis| |
| +--------+---------+ +--------+---------+ +--------+---------+ |
| | | | |
| +---------------------+---------------------+ |
| | |
| v |
| +-------------------------------------------------------------+ |
| | SHARED PACKAGES | |
| | +---------------+ +---------------+ +---------------+ | |
| | | shared-ui | | shared-ai | | shared-api | | |
| | | (HeroUI) | | (WASM Core) | | (Airtable/PG) | | |
| | +---------------+ +---------------+ +---------------+ | |
| +-------------------------------------------------------------+ |
| | |
| v |
| +-------------------------------------------------------------+ |
| | INFRASTRUCTURE | |
| | +---------------+ +---------------+ +---------------+ | |
| | | Cloud Run | | Cloud SQL | | Secret Mgr | | |
| | | (6 services) | | (RuVector PG) | | (Credentials) | | |
| | +---------------+ +---------------+ +---------------+ | |
| +-------------------------------------------------------------+ |
| |
+-------------------------------------------------------------------------+
/extensions-cloudrun/
+-- turbo.json # Turborepo configuration
+-- package.json # Root workspace
+-- packages/
| +-- shared-ui/ # Shared HeroUI components
| | +-- components/
| | +-- hooks/
| | +-- theme/
| | +-- utils/
| +-- shared-ai/ # AI/ML algorithms (Q-Learning, Monte Carlo, etc.)
| | +-- ml/
| | +-- simulation/
| | +-- graph/
| | +-- vectors/
| +-- shared-api/ # API clients (Airtable, PostgreSQL)
| +-- airtable/
| +-- postgres/
| +-- auth/
+-- apps/
| +-- sales-pipeline/ # P0 Extension
| +-- financial-ops/ # P0 Extension
| +-- hr-compensation/ # P1 Extension
| +-- compliance-legal/ # P1 Extension
| +-- customer-success/ # P2 Extension
| +-- revenue-ops/ # P2 Extension
+-- docker/
+-- Dockerfile.extension # Shared Dockerfile template
Each extension deploys as an independent Cloud Run service:
| Extension | Service Name | URL Pattern | Resources |
|---|---|---|---|
| Sales Pipeline | ext-sales-pipeline | ext-sales-pipeline-*.run.app | 512Mi, 1 vCPU |
| Financial Ops | ext-financial-ops | ext-financial-ops-*.run.app | 512Mi, 1 vCPU |
| HR Compensation | ext-hr-compensation | ext-hr-compensation-*.run.app | 512Mi, 1 vCPU |
| Compliance Legal | ext-compliance-legal | ext-compliance-legal-*.run.app | 512Mi, 1 vCPU |
| Customer Success | ext-customer-success | ext-customer-success-*.run.app | 512Mi, 1 vCPU |
| Revenue Ops | ext-revenue-ops | ext-revenue-ops-*.run.app | 512Mi, 1 vCPU |
+--------------------------------------------+
| Cloud Run Container |
| +--------------------------------------+ |
| | Nginx (Static Assets/Routing) | |
| | ViteJS Build Output | |
| +--------------------------------------+ |
| +--------------------------------------+ |
| | Node.js API Server (Express) | |
| | API Routes + Middleware | |
| +--------------------------------------+ |
+--------------------------------------------+
| | |
v v v
+-----------+ +------------+ +----------+
| Airtable | | Cloud SQL | | Cloud |
| API | | PostgreSQL | | Functions|
+-----------+ +------------+ +----------+
All extensions connect to a shared Cloud SQL instance with the RuVector extension:
conveyor-ruvector-dbconveyor_aiCentralized credential storage:
| Package | Purpose | Location |
|---|---|---|
shared-ui | HeroUI components, theme, hooks | packages/shared-ui/ |
shared-ai | Q-Learning, Monte Carlo, MinCut, Vectors | packages/shared-ai/ |
shared-api | Airtable client, PostgreSQL client, Auth | packages/shared-api/ |
User Request
|
v
+------------------+
| Extension UI |
| (React + HeroUI) |
+------------------+
|
v
+------------------+
| QueryRouter |-----> Airtable (CRUD operations)
+------------------+
|
v
+------------------+
| Cloud SQL + AI |-----> Vector Search, Predictions
| (RuVector) |-----> Q-Learning State
+------------------+
|
v
+------------------+
| SyncManager |-----> Bidirectional Sync
+------------------+
Document Version: 1.0 Last Updated: 2026-01-12