Skip to content

Architecture

The platform at the highest level. Component-level detail lives in the Components page; protocol-level detail in the OpenSpec.

Two paths through it are described on their own sites: how an event travels through a worker and how a live order travels.

System context

flowchart TB
    subgraph Clients
        CSharp[C# Client]
        Python[Python Client]
        TS[TypeScript Client]
    end

    subgraph Edge["Edge — single entry point"]
        API[Virtufin API Gateway<br/>gRPC :5002]
    end

    subgraph Services["Virtufin services"]
        WM[WorkManager<br/>worker catalog and router]
        RT[WorkManager Runtime<br/>one actor per worker]
    end

    subgraph Engines["Engines (in the Runtime)"]
        DLL[.NET DLL workers<br/>in the Runtime process<br/>incl. WebSocketFeed]
        NAT[Native workers<br/>C ABI, in the Runtime process]
        PY[Python workers<br/>child process]
        CS[C# source workers<br/>child process, Roslyn]
        TSW[TypeScript workers<br/>child process, Node]
    end

    subgraph Sidecar["Dapr sidecar (per pod)"]
        PS[(Pub/Sub<br/>Redis)]
        ST[(State<br/>Redis)]
    end

    subgraph Data["Upstream data"]
        EX[Exchanges / feeds<br/>Binance, Alpaca, etc.]
    end

    Clients --> API
    API <--> PS
    API <--> ST
    API --> WM
    DLL <-->|WebSocket| EX
    WM --> RT
    RT --> API
    RT --> DLL
    RT --> NAT
    RT --> PY
    RT --> CS
    RT --> TSW

The two things to notice: the API gateway is the only public face, and the only service that talks to Dapr pub/sub and state. Dapr is the only thing that talks to the broker and state store. The WorkManager Runtime publishes and subscribes through the gateway; Dapr actors place each worker on one pod. An upstream WebSocket connection is a worker too: a WebSocketFeed opens the socket in its StartAsync and publishes its frames through the Runtime's outbox, under the worker's lease.

Event envelope

Every event is a CloudEvents 1.0 envelope with Virtufin extensions (see Concepts). The same producer can target production and backtest by switching the topic from act.* to hyp.<name>.*, or from sc.LIVE.* to sc.<scenarioId>.*. The data universe is not part of the topic: it travels in the marketuniverse extension.

For the formal definition, see the pubsub-topics spec.