Skip to content

Architecture Overview

tonythethompson edited this page Jul 28, 2026 · 3 revisions

High-Level Architecture

Section: Architecture · Getting-Started · Home · Layered-Dependency-Rules

Trackdub is a .NET 10 local-first AI dubbing workstation: ingest, transcribe, translate, synthesize, mix, and export with ONNX Runtime. Privacy, hardware acceleration, and manifest-gated model governance are first-class.

The architecture follows Domain-Driven Design with a strict layered dependency model. Business logic sits in Domain, which depends on nothing. The Avalonia UI and Sdk/Cli hosts sit above Application.

Layered architecture

flowchart TD
    App[Trackdub.App.Avalonia] --> AppLayer[Trackdub.Application]
    App --> Composition[Trackdub.Composition]
    App --> Domain[Trackdub.Domain]
    App --> Playback[Trackdub.Media.Playback]
    App --> Sdk[Trackdub.Sdk]
    App --> Licensing[Trackdub.Licensing]

    Cli[Trackdub.Cli] --> Sdk
    Sdk --> Composition
    Sdk --> AppLayer

    Composition --> AppLayer
    Composition --> Inference[Trackdub.Inference]
    Composition --> InferenceONNX[Trackdub.Inference.Onnx]
    Composition --> Infra[Trackdub.Infrastructure]
    Composition --> Media[Trackdub.Media]
    Composition --> Playback
    Composition --> Licensing

    AppLayer --> Contracts[Trackdub.Contracts]
    AppLayer --> Domain
    AppLayer --> Licensing

    Infra --> AppLayer
    Infra --> Contracts
    Infra --> Domain

    Inference --> Contracts
    Inference --> Domain
    InferenceONNX --> Inference

    Contracts --> Domain
    Domain --> NONE[No Dependencies]
Loading

Project responsibility map

Project Responsibility
Trackdub.App.Avalonia Cross-platform desktop UI shell (ReactiveUI + CommunityToolkit.Mvvm).
Trackdub.Domain Entities, value objects, invariants. Zero external dependencies.
Trackdub.Contracts DTOs and shared service contracts.
Trackdub.Application Pipeline orchestration, stage planning, execution snapshots, project services.
Trackdub.Infrastructure Persistence (SQLite/Dapper), filesystem, logging.
Trackdub.Inference Model abstractions, manifests, execution-provider selection.
Trackdub.Inference.Onnx ONNX Runtime and Windows ML implementations.
Trackdub.Media FFmpeg extraction, normalization, muxing.
Trackdub.Media.Playback libmpv (primary) / LibVLC (fallback) backends.
Trackdub.Composition DI wiring for runnable hosts.
Trackdub.Sdk / Trackdub.Cli Headless session API and CLI.
Trackdub.Licensing Licensing hooks used by the desktop host.
Trackdub.Analyzers Roslyn analyzers (compile-time only).

In the app checkout, Application/Inference/Media and related projects resolve from external/Trackdub/src/. UI code lives under src/Trackdub.App.Avalonia/. See Desktop-UI-Architecture.

Pipeline execution model

The pipeline is explicit, ordered, and resumable. Each run uses an immutable execution snapshot so UI or settings changes cannot mutate in-flight work.

Typical stages: optional separation → VAD → diarization → ASR → translation → TTS → mix/export.

Readiness and safety

  • Manifest presence ≠ downloaded ≠ ran ≠ succeeded
  • Skip/failure must log structured reasons and preserve usable prior artifacts
  • No fake readiness in UI surfaces

AI model governance

Manifest-gated models only. Key fields include model_id, task, commercial flags, expected_runtime, and sha256. Shipping lane is commercial-safe ONNX only.

Inventory path: src/Trackdub.Inference/Runtime/ModelManifest/bundled-models.manifest.json.

Hardware acceleration

Cross-platform portable .NET and Avalonia APIs by default. Inference uses ONNX Runtime with platform EPs.

On Windows: TensorRT RTX as a standalone EP ABI plugin when available; Windows ML for catalog/device-policy routes; DirectML as legacy GPU fallback. Provider registration is never treated as model readiness. See ONNX-Execution-Providers.

Data persistence

One SQLite database per project. Artifact binaries live on the filesystem relative to the project. Persistence stays in Infrastructure; ViewModels must not run SQL. See Local-Project-Persistence.

Related

Clone this wiki locally