# barvian/number-flow architecture

> Architecture diagram of the GitHub repository barvian/number-flow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/barvian/number-flow
- Repository: https://github.com/barvian/number-flow

## Overview

##### Main Components Identification
The project is structured as a monorepo with multiple packages targeting different frontend frameworks. Here's how to represent the core architecture:

a. Core Components:
- Base Package (number-flow)
- Framework Implementations (React, Vue, Svelte)
- Documentation Site
- Test Suites

**┌─ Framework Implementations ─┐**
- ┌────────┐ ┌────────┐ ┌───────┐
- React  │ │  Vue   │ │Svelte │
- ┘ └────────┘ └───────┘
- ┘

**┌─ Core Library (number-flow) ──────┐**
- ┌────────┐ ┌────────┐ ┌───────┐ │
- Formatter│ │Plugins │ │Utils  │ │
- ┘ └────────┘ └───────┘ │
- ┘

##### Key Architectural Elements to Highlight

a. Core Library Layer:
- Formatter (src/formatter.ts)
- Plugin System (src/plugins/)
- Utility Functions (src/util/)
- SSR Support (src/ssr.ts)

b. Framework Integration Layer:
- React Implementation (/packages/react)
- Vue Implementation (/packages/vue)
- Svelte Implementation (/packages/svelte)

c. Testing Infrastructure:
- Test Suites for Each Framework
- E2E Tests with Playwright
- Snapshot Testing

##### Integration Points
- How each framework package depends on the core library
- Plugin system's extensibility
- Demonstrate SSR compatibility flow

##### Data Flow Representation
**User Input → Framework Component → Core Formatter → Animation Pipeline → Rendered Output**

##### Testing and CI/CD pipeline integration

This system design will help developers understand how the different pieces fit together and how to extend or modify the library while maintaining its core principles.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Framework Layer"
        React["React Package"]:::react
        Vue["Vue Package"]:::vue
        Svelte["Svelte Package"]:::svelte
    end

    subgraph "Core Library"
        Formatter["Formatter"]:::core
        Plugins["Plugin System"]:::core
        Utils["Utilities"]:::core
        SSR["SSR Support"]:::core
    end

    subgraph "Testing Infrastructure"
        TestSuites["Test Suites"]:::test
        E2ETests["E2E Tests"]:::test
        ReactTests["React Tests"]:::test
        VueTests["Vue Tests"]:::test
        SvelteTests["Svelte Tests"]:::test
    end

    subgraph "CI/CD"
        CI["CI Pipeline"]:::cicd
        Release["Release Pipeline"]:::cicd
    end

    subgraph "Documentation"
        DocSite["Documentation Site"]:::docs
    end

    %% Core Dependencies
    React --> Formatter
    React --> Plugins
    React --> Utils
    React --> SSR

    Vue --> Formatter
    Vue --> Plugins
    Vue --> Utils
    Vue --> SSR

    Svelte --> Formatter
    Svelte --> Plugins
    Svelte --> Utils
    Svelte --> SSR

    %% Testing Relationships
    ReactTests --> React
    VueTests --> Vue
    SvelteTests --> Svelte
    E2ETests --> TestSuites
    
    %% CI/CD Relationships
    CI --> TestSuites
    CI --> E2ETests
    Release --> CI

    %% Documentation
    DocSite --> React
    DocSite --> Vue
    DocSite --> Svelte

    %% Styling
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef react fill:#4CAF50,stroke:#2E7D32,color:white
    classDef vue fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef svelte fill:#FF9800,stroke:#EF6C00,color:white
    classDef test fill:#757575,stroke:#424242,color:white
    classDef cicd fill:#607D8B,stroke:#455A64,color:white
    classDef docs fill:#00BCD4,stroke:#00838F,color:white

    %% Click Events
    click React "https://github.com/barvian/number-flow/tree/main/packages/react/"
    click Vue "https://github.com/barvian/number-flow/tree/main/packages/vue/"
    click Svelte "https://github.com/barvian/number-flow/tree/main/packages/svelte/"
    click Formatter "https://github.com/barvian/number-flow/blob/main/packages/number-flow/src/formatter.ts"
    click Plugins "https://github.com/barvian/number-flow/tree/main/packages/number-flow/src/plugins/"
    click Utils "https://github.com/barvian/number-flow/tree/main/packages/number-flow/src/util/"
    click SSR "https://github.com/barvian/number-flow/blob/main/packages/number-flow/src/ssr.ts"
    click TestSuites "https://github.com/barvian/number-flow/tree/main/test-suites/"
    click E2ETests "https://github.com/barvian/number-flow/blob/main/lib/playwright.ts"
    click ReactTests "https://github.com/barvian/number-flow/tree/main/packages/react/test/"
    click VueTests "https://github.com/barvian/number-flow/tree/main/packages/vue/test/"
    click SvelteTests "https://github.com/barvian/number-flow/tree/main/packages/svelte/tests/"
    click DocSite "https://github.com/barvian/number-flow/tree/main/site/"
    click CI "https://github.com/barvian/number-flow/blob/main/.github/workflows/ci.yml"
    click Release "https://github.com/barvian/number-flow/blob/main/.github/workflows/release.yml"
```
