Architecture Overview

High-Level Architecture

┌─────────────────────────────────────────────────────────────────────────────────┐
│                           END USERS (Enterprise Customers)                      │
│                                                                                 │
│   ┌─────────────┐    ┌─────────────┐    ┌─────────────┐    ┌─────────────┐    │
│   │ HTTP Client │    │ TCP Client  │    │ SDK/CLI     │    │ Web Console │    │
│   └──────┬──────┘    └──────┬──────┘    └──────┬──────┘    └──────┬──────┘    │
└──────────┼──────────────────┼──────────────────┼──────────────────┼───────────┘
           │                  │                  │                  │
           ▼                  ▼                  ▼                  ▼
┌─────────────────────────────────────────────────────────────────────────────────┐
│                        CLOUDFLARE GLOBAL NETWORK                                │
│  ┌───────────────────────────────────────────────────────────────────────────┐ │
│  │                         ROUTING LAYER                                      │ │
│  │  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐           │ │
│  │  │  HTTP Router    │  │  TCP Router     │  │  WebSocket      │           │ │
│  │  │  (Workers)      │  │  (Spectrum+DO)  │  │  Gateway        │           │ │
│  │  └────────┬────────┘  └────────┬────────┘  └────────┬────────┘           │ │
│  └───────────┼────────────────────┼────────────────────┼────────────────────┘ │
│              │                    │                    │                       │
│  ┌───────────┴────────────────────┴────────────────────┴────────────────────┐ │
│  │                      CONTROL PLANE                                        │ │
│  │  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  │ │
│  │  │ Workload     │  │ Price        │  │ Health       │  │ Auth         │  │ │
│  │  │ Orchestrator │  │ Arbitrage    │  │ Monitor      │  │ Service      │  │ │
│  │  │ (Workflows)  │  │ Engine (DO)  │  │ (Workers)    │  │ (Workers)    │  │ │
│  │  └──────────────┘  └──────────────┘  └──────────────┘  └──────────────┘  │ │
│  └───────────────────────────────────────────────────────────────────────────┘ │
│                                                                                 │
│  ┌───────────────────────────────────────────────────────────────────────────┐ │
│  │                      DATA LAYER                                           │ │
│  │  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  │ │
│  │  │ D1           │  │ KV           │  │ Durable      │  │ R2           │  │ │
│  │  │ (Workloads)  │  │ (Routing)    │  │ Objects      │  │ (Artifacts)  │  │ │
│  │  │              │  │              │  │ (State)      │  │              │  │ │
│  │  └──────────────┘  └──────────────┘  └──────────────┘  └──────────────┘  │ │
│  └───────────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────────────────────┐
│                           KIVERA PROXY LAYER                                    │
│  ┌──────────────────────────────────────────────────────────────────────────┐  │
│  │  Policy Enforcement • Data Boundaries • Audit Logging • Compliance       │  │
│  └──────────────────────────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────────────────────────┘

           ┌──────────────────────────┼──────────────────────────┐
           ▼                          ▼                          ▼
┌─────────────────────┐  ┌─────────────────────┐  ┌─────────────────────┐
│        AWS          │  │       AZURE         │  │        GCP          │
│  ┌───────────────┐  │  │  ┌───────────────┐  │  │  ┌───────────────┐  │
│  │ EC2 Spot      │  │  │  │ Spot VMs      │  │  │  │ Preemptible   │  │
│  │ Instances     │  │  │  │               │  │  │  │ VMs           │  │
│  └───────────────┘  │  │  └───────────────┘  │  │  └───────────────┘  │
│  ┌───────────────┐  │  │  ┌───────────────┐  │  │  ┌───────────────┐  │
│  │ VPC/Subnets   │  │  │  │ VNet/Subnets  │  │  │  │ VPC/Subnets   │  │
│  └───────────────┘  │  │  └───────────────┘  │  │  └───────────────┘  │
│  ┌───────────────┐  │  │  ┌───────────────┐  │  │  ┌───────────────┐  │
│  │ IAM Roles     │  │  │  │ Managed       │  │  │  │ Service       │  │
│  │               │  │  │  │ Identities    │  │  │  │ Accounts      │  │
│  └───────────────┘  │  │  └───────────────┘  │  │  └───────────────┘  │
└─────────────────────┘  └─────────────────────┘  └─────────────────────┘

Design Principles

  1. Stateless routing, stateful coordination - Routing decisions cached in KV, complex state in Durable Objects
  2. Eventually consistent with strong guarantees - Price data cached, routing updates propagate globally in <1s
  3. Graceful degradation - System continues operating even if price feeds are delayed
  4. Security by default - All cloud operations routed through Kivera for policy enforcement
  5. Multi-tenant isolation - Each customer operates in isolated cloud accounts/projects