Skip to content

Common Diagrams

Here are simplified versions of the most important diagrams that were having rendering issues.

Monorepo Development Workflow

graph TD
    Start[Start Development] --> Clone[Clone Repository]
    Clone --> Install[Install Dependencies]
    Install --> SetupLocal[Setup Local Environment]
    SetupLocal --> SetupDB[Setup Databases]
    SetupDB --> Implement[Implement Feature/Fix]
    Implement --> BuildLib[Build Libraries]
    Implement --> Lint[Lint Code]
    Implement --> UnitTest[Run Unit Tests]
    BuildLib --> DevFlow{Development Complete?}
    Lint --> DevFlow
    UnitTest --> DevFlow
    DevFlow -->|No| Implement
    DevFlow -->|Yes| Validate[Validate All Changes]
    Validate --> Integration[Run Integration Tests]
    Integration --> Branch[Create Branch]
    Branch --> Commit[Commit Changes]
    Commit --> Push[Push Changes]
    Push --> PR[Create Pull Request]
    PR --> Review[Code Review Process]
    Review -->|Approved| Merge[Merge PR]
    Review -->|Changes Requested| Implement
    Merge --> End[End Development]

Command Selection Decision Tree

graph TD
    Start[Command Needed] --> TaskType{Task Type?}
    TaskType -->|Building| Build{What to build?}
    TaskType -->|Testing| Test{What to test?}
    TaskType -->|Developing| Dev{Development task?}
    Build -->|One project| BuildOne[nx build project-name]
    Build -->|Affected projects| BuildAffected[nx affected -t build]
    Build -->|All projects| BuildAll[nx run-many -t build]
    Test -->|Unit tests| TestUnit[nx test project-name]
    Test -->|Integration tests| TestInteg[nx test with integration config]
    Test -->|Affected tests| TestAffected[nx affected -t test]
    Dev -->|Lint| Lint[nx lint project-name]
    Dev -->|Type check| TypeCheck[nx run project:typecheck]
    Dev -->|Start service| Serve[nx serve project-name]
    Dev -->|Full validation| Validate[nx run project:validate]
    BuildOne --> Done[Command Selected]
    BuildAffected --> Done
    BuildAll --> Done
    TestUnit --> Done
    TestInteg --> Done
    TestAffected --> Done
    Lint --> Done
    TypeCheck --> Done
    Serve --> Done
    Validate --> Done

Troubleshooting Decision Tree

graph TD
    Start[Error Encountered] --> ErrorType{Error type?}
    ErrorType -->|Build| BuildError{Build error type?}
    ErrorType -->|Test| TestError{Test error type?}
    ErrorType -->|Runtime| RuntimeError{Runtime error type?}
    BuildError -->|Dependency| DependencyIssue[Check package versions]
    BuildError -->|TypeScript| TSError[Check types]
    BuildError -->|Memory| MemoryError[Use retry build]
    TestError -->|Not found| TestNotFound[Check test path]
    TestError -->|Timeout| TestTimeout[Increase timeout]
    TestError -->|Environment| TestEnvError[Setup mock env]
    RuntimeError -->|Connection| ConnectionError[Check connectivity]
    RuntimeError -->|Configuration| ConfigError[Verify env vars]
    RuntimeError -->|Resource| ResourceError[Check resource limits]
    DependencyIssue --> Solution[Solution Found]
    TSError --> Solution
    MemoryError --> Solution
    TestNotFound --> Solution
    TestTimeout --> Solution
    TestEnvError --> Solution
    ConnectionError --> Solution
    ConfigError --> Solution
    ResourceError --> Solution

Component Architecture

graph TB
    subgraph ServiceLayer[Service Layer]
        Orderbook[Orderbook Service]
        Sequencer[Sequencer Service]
        Datastream[Datastream Service]
        Relayer[Relayer Service]
        Websockets[Websockets Service]
    end

    subgraph LibrariesLayer[Libraries Layer]
        CommonsTS[commons-ts]
        Commons[commons]
        ConnectionsTS[connections-ts]
        Chainpyon[chainpyon]
    end

    subgraph External[External Integrations]
        Blockchain[Blockchain]
        PriceFeeds[Price Feeds]
    end

    subgraph Storage[Storage Layer]
        Redis[Redis]
        CloudSQL[Cloud SQL]
        BigQuery[BigQuery]
    end

    Orderbook --> CommonsTS
    Orderbook --> ConnectionsTS
    Sequencer --> CommonsTS
    Sequencer --> ConnectionsTS
    Datastream --> CommonsTS
    Datastream --> ConnectionsTS

    Orderbook --> Sequencer
    Orderbook --> Websockets
    Sequencer --> Relayer
    Datastream --> Orderbook

    Relayer --> Blockchain
    Datastream --> PriceFeeds

    Orderbook --> Redis
    Orderbook --> CloudSQL
    Sequencer --> Redis
    Sequencer --> CloudSQL