Skip to main content

Sync Architecture MoE Evaluation

CODITECT Sync Architecture - MoE Evaluation Report

Date: 2025-12-29 Status: Complete Outcome: ADR-044 - Custom REST Sync Architecture

Executive Summary

A Mixture of Experts (MoE) evaluation was conducted to select the optimal sync architecture for CODITECT's context memory system. Four specialized judges evaluated four architecture options across technical, legal, operational, and financial dimensions.

Winner: Option D (SQLite + Custom REST Sync) with weighted score of 7.49/10

Key Finding: PowerSync (Option B) is legally disqualified due to FSL license "Competing Use" restrictions.


Evaluation Framework

MoE Judge Panel

JudgeSpecializationKey Criteria
Judge 1Technical ArchitectureScalability, reliability, integration, future-proofing
Judge 2License & SecurityLegal risk, compliance, vendor dependency, attack surface
Judge 3OperationsDeployment complexity, maintenance, disaster recovery
Judge 4Cost-BenefitDevelopment cost, infrastructure, TCO, time-to-market

Options Evaluated

OptionArchitectureKey Technology
APostgreSQL-Everywherepostgresql-embedded + pglogical
BSQLite + PowerSyncPowerSync (FSL license)
CSQLite + ElectricSQLElectricSQL (Apache 2.0)
DSQLite + Custom RESTFastAPI/Django REST API

Consolidated Scoring Matrix

JudgeOption AOption BOption COption D
Technical (15%)8.107.708.406.15
License/Security (30%)8.804.658.258.85
Operations (25%)7.055.006.557.75
Cost-Benefit (30%)4.856.955.157.20
WEIGHTED TOTAL7.206.087.097.49

Ranking by Weighted Score

  1. Option D (Custom REST Sync) - 7.49/10 ✅ RECOMMENDED
  2. Option A (PostgreSQL-Everywhere) - 7.20/10
  3. Option C (ElectricSQL) - 7.09/10
  4. Option B (PowerSync) - 6.08/10 ⛔ DISQUALIFIED (License)

Judge 1: Technical Architecture Evaluation

Detailed Scores

Criterion (Weight)Option AOption BOption COption D
Architectural Elegance (15%)7/108/109/106/10
Scalability (20%)9/108/108/107/10
Reliability (20%)9/108/107/105/10
Maintainability (15%)6/107/108/104/10
Integration Fit (15%)8/109/109/107/10
Future Proofing (15%)9/106/1010/108/10
TOTAL8.107.708.406.15

Key Findings

  • ElectricSQL leads technically (8.4/10) - CRDT conflict resolution, elegant 2-component architecture
  • Custom REST lowest technical score (6.15/10) - but acceptable for CODITECT's current scale
  • PostgreSQL-Everywhere overkill - 50-100MB client install vs 1MB SQLite

Judge 2: License & Security Assessment

Detailed Scores

Criterion (Weight)Option AOption BOption COption D
License Safety (30%)9/103/1010/1010/10
Data Security (25%)10/108/109/109/10
Compliance Readiness (20%)10/106/108/109/10
Vendor Risk (15%)7/102/105/109/10
Attack Surface (10%)8/107/107/106/10
TOTAL8.804.658.258.85

Critical Finding: PowerSync License

FSL "Competing Use" clause is a legal minefield:

"You may not use the Software for any Competing Use. 'Competing Use' means making available any product or service that substitutes for the Products."

  • JourneyApps offers no-code mobile app builder with offline sync
  • CODITECT's development platform could be interpreted as competing
  • Legal risk of license violation unacceptable for SaaS
  • Score: 3/10 for License Safety = DISQUALIFIED

ElectricSQL Concern

  • Development paused November 2024
  • Apache 2.0 license is safe, but maintenance burden unknown
  • Score reduced from 10/10 to 5/10 for Vendor Risk

Judge 3: Operational Complexity

Detailed Scores

Criterion (Weight)Option AOption BOption COption D
Deployment Complexity (25%)6/103/105/108/10
Client Installation (15%)4/109/109/109/10
Monitoring & Observability (20%)9/105/106/108/10
Disaster Recovery (20%)9/106/107/108/10
Scaling Operations (10%)7/104/106/107/10
Maintenance Burden (10%)8/104/106/107/10
TOTAL7.055.006.557.75

Key Findings

  • Custom REST simplest topology - 3 services (Django, PostgreSQL, Redis)
  • PowerSync most complex - 5 services (Django, PostgreSQL, PowerSync, Redis, MongoDB)
  • Client installation parity - SQLite options all ~1MB vs 50-100MB for PostgreSQL-embedded

Judge 4: Cost-Benefit Analysis

5-Year Total Cost of Ownership

ComponentOption AOption BOption COption D
Development$45,000$15,000$30,000$18,000
Infrastructure (5yr)$36,000$17,700$12,000$3,000
Maintenance (5yr)$60,000$36,000$108,000$25,200
TOTAL TCO$117,000$54,300$150,000$41,400

Time to Market

OptionImplementation TimeMeets Dec 2025 Pilot?
A: PostgreSQL-Everywhere19 weeks❌ No
B: PowerSync6 weeks⛔ Disqualified
C: ElectricSQL10 weeks❌ No
D: Custom REST8 weeks✅ Achievable

Cost-Benefit Scores

Criterion (Weight)Option AOption BOption COption D
Development Cost (25%)4/108/105/107/10
Infrastructure Cost (20%)6/104/107/109/10
Maintenance Cost (20%)5/107/104/106/10
Time to Market (15%)3/109/104/107/10
Business Value (10%)7/108/107/106/10
5-Year TCO (10%)5/106/104/108/10
TOTAL4.856.955.157.20

Decision Rationale

Why Custom REST Sync (Option D)?

  1. Best weighted score (7.49/10) across all judges
  2. Lowest 5-year TCO ($41,400) - $12,900 less than PowerSync
  3. Zero legal risk - no third-party sync library licenses
  4. Simplest operations - 3 services, familiar Django/FastAPI stack
  5. Full control - custom sync logic, no vendor lock-in
  6. Achievable timeline - 8 weeks fits pilot launch

Why NOT the Others?

OptionReason for Rejection
A: PostgreSQL-Everywhere50-100MB client install too heavy; 19-week timeline misses pilot
B: PowerSyncFSL license legally disqualifying - "Competing Use" risk
C: ElectricSQLDevelopment paused (Nov 2024); highest TCO ($150K); maintenance risk

Implementation Recommendation

Phase 1: Backend API (Weeks 1-2)

  • FastAPI/Django sync endpoints
  • PostgreSQL schema with tenant_id
  • JWT authentication integration

Phase 2: Conflict Resolution (Weeks 3-4)

  • Last-write-wins with timestamps
  • Content-hash deduplication
  • Soft delete support

Phase 3: Client Library (Weeks 5-6)

  • Python sync client with retry logic
  • Background sync daemon
  • Offline queue management

Phase 4: Testing (Weeks 7-8)

  • Integration tests
  • Load testing (100+ concurrent clients)
  • Security review

Risk Mitigation

RiskProbabilityImpactMitigation
Timeline overrunMediumHighStart immediately; reduce scope if needed
Conflict resolution bugsMediumMediumComprehensive test suite
Scaling bottlenecksLowMediumCloud Run auto-scales
Security vulnerabilitiesLowHighThird-party pentest ($15-25K)

Appendix: Judge Weighting Methodology

JudgeWeightRationale
License & Security30%Legal risk is existential for SaaS
Cost-Benefit30%Budget constraints critical for pilot
Operations25%DevOps capacity limited
Technical15%All options technically viable

Total: 100%


References


Evaluation Completed: 2025-12-29 Decision Document: ADR-044 Confidence Level: 85% (High) Review Date: Q1 2026 (post-pilot)