# arnauddoub/formyle architecture

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

- Interactive diagram: https://gitdiagram.com/arnauddoub/formyle
- Repository: https://github.com/arnauddoub/formyle

## Overview

##### Main Components & Overall Structure
- Library Core: The main code lives in the “src” folder (and also in some parts in “example”). This includes all the reusable Vue components (e.g., “form”, “field”, “input”, “categories”, “birth-date”, “radio-button”, “radio-group”, “select”, “navigation”, “heading”, etc.), utility functions (in “src/utils”), and styling (in “src/styles”).
- Example/Demo Application: The “example” directory includes a demo app that utilizes the library. It contains its own Vue components (e.g., App.vue), router configuration (in “example/src/router”), a steps system with different versions (v1, v2 in “example/src/steps”), Vuex store usage for managing state (in “example/src/store/”), and a demonstration view (e.g., Quote.vue).
- Build and Configuration: The project includes build configuration files for both Vite (vite.config.js) and Babel (babel.config.js), along with Tailwind and ESLint/Prettier configurations. These indicate that the build and code styling pipelines are well integrated.

##### Relationships & Interactions
- The reusable Vue components in “src/components” are the building blocks of the entire form library. They interact with each other when building a form (for example, a parent “form” component leveraging “input”, “select”, “radio-group”, etc.).
- The Vuex store (with modules defined in “example/src/store”) manages shared state within the demo (and possibly internal state management within the library).
- The Vue Router configuration in the “example/src/router” delineates navigation between different steps/views, especially highlighting the “steps” system where multiple versions (v1 and v2) indicate the possibility of A/B testing features.
- External dependencies like Vue 3 (for component logic), Tailwind CSS (for styling), Vite 2 (for development/build pipeline), and Vuex 4 (for state management) form the ecosystem essential for the application.

##### Architectural Patterns & Design Principles
- Component-Based Architecture: The system is modularized into Vue components that are encapsulated and reusable.
- Separation of Concerns: The code is organized so that styling, business logic (via Vuex), routing (via Vue Router), and component rendering are separated.
- Extensibility: Multiple versions of the steps system (located under “example/src/steps/v1” and “example/src/steps/v2”) hint at a plugin/extension or A/B testing architecture.
- Testability: Dedicated “test” directory with unit tests indicates that testing is a core part of the design.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Library Core
    subgraph "Library Core"
        LC1["Components"]:::library
        LC2["Utils"]:::library
        LC3["Styles"]:::library
    end

    %% Demo Application
    subgraph "Demo Application"
        DA1["Main Vue App"]:::demo
        DA2["Views"]:::demo
        DA3["Routing Module"]:::demo
        DA4["Vuex Store"]:::demo
        subgraph "Steps System"
            ST1["Steps v1"]:::demo
            ST2["Steps v2"]:::demo
        end
        SAG["Steps Aggregator"]:::demo
    end

    %% Build & Configuration
    subgraph "Build & Configuration"
        BC1a["Vite Config (Root)"]:::config
        BC1b["Vite Config (Demo)"]:::config
        BC2["Babel Config"]:::config
        BC3["Tailwind/PostCSS Config"]:::config
        BC4["Lint/Formatting"]:::config
        BC5["Other Config"]:::config
    end

    %% External Dependencies
    subgraph "External Dependencies"
        ED1["Vue 3"]:::external
        ED2["Vuex 4"]:::external
        ED3["Vite 2"]:::external
        ED4["Tailwind CSS"]:::external
    end

    %% Relationships between Library Core and Demo Application
    LC1 -->|"usedIn"| DA1
    LC2 -->|"supports"| DA1
    LC3 -->|"styles"| DA1

    %% Internal Demo Application relationships
    DA1 -->|"renders"| DA2
    DA1 -->|"navigates"| DA3
    DA1 -->|"managesState"| DA4
    DA3 -->|"integratesWith"| SAG
    SAG -->|"aggregates"| ST1
    SAG -->|"aggregates"| ST2

    %% Build & Configuration connections to Library Core and Demo Application
    BC1a -->|"builds"| LC1
    BC2  -->|"builds"| LC1
    BC3  -->|"styles"| LC3
    BC4  -->|"formats"| LC1
    BC5  -->|"configures"| LC1

    BC1b -->|"builds"| DA1
    BC2  -->|"builds"| DA1
    BC3  -->|"styles"| DA1
    BC4  -->|"formats"| DA1
    BC5  -->|"configures"| DA1

    %% External Dependencies connections
    ED1 -->|"framework"| LC1
    ED1 -->|"framework"| DA1
    ED2 -->|"stateManagement"| DA4
    ED3 -->|"devTool"| DA1
    ED4 -->|"styles"| LC3

    %% Click Events for Library Core
    click LC1 "https://github.com/arnauddoub/formyle/tree/main/src/components/"
    click LC2 "https://github.com/arnauddoub/formyle/tree/main/src/utils/"
    click LC3 "https://github.com/arnauddoub/formyle/blob/main/src/styles/main.css"

    %% Click Events for Demo Application
    click DA1 "https://github.com/arnauddoub/formyle/blob/main/example/src/App.vue"
    click DA1 "https://github.com/arnauddoub/formyle/blob/main/example/src/main.js"
    click DA2 "https://github.com/arnauddoub/formyle/blob/main/example/src/views/Quote.vue"
    click DA3 "https://github.com/arnauddoub/formyle/blob/main/example/src/router/index.js"
    click DA4 "https://github.com/arnauddoub/formyle/tree/main/example/src/store/"
    click ST1 "https://github.com/arnauddoub/formyle/tree/main/example/src/steps/v1/"
    click ST2 "https://github.com/arnauddoub/formyle/tree/main/example/src/steps/v2/"
    click SAG "https://github.com/arnauddoub/formyle/blob/main/example/src/steps/index.js"

    %% Click Events for Build & Configuration
    click BC1a "https://github.com/arnauddoub/formyle/blob/main/vite.config.js"
    click BC1b "https://github.com/arnauddoub/formyle/blob/main/example/vite.config.js"
    click BC2 "https://github.com/arnauddoub/formyle/blob/main/babel.config.js"
    click BC3 "https://github.com/arnauddoub/formyle/blob/main/tailwind.config.js"
    click BC3 "https://github.com/arnauddoub/formyle/blob/main/postcss.config.js"
    click BC4 "https://github.com/arnauddoub/formyle/blob/main/.eslintrc.js"
    click BC4 "https://github.com/arnauddoub/formyle/blob/main/.prettierrc"
    click BC5 "https://github.com/arnauddoub/formyle/blob/main/jsconfig.json"
    click BC5 "https://github.com/arnauddoub/formyle/blob/main/pnpm-lock.yaml"

classDef library fill:#ADD8E6,stroke:#000,stroke-width:1px;
classDef demo fill:#90EE90,stroke:#000,stroke-width:1px;
classDef config fill:#FFD700,stroke:#000,stroke-width:1px;
classDef external fill:#FFB6C1,stroke:#000,stroke-width:1px;
```
