# openzeppelin/contracts-wizard architecture

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

- Interactive diagram: https://gitdiagram.com/openzeppelin/contracts-wizard
- Repository: https://github.com/openzeppelin/contracts-wizard

## Overview

##### Begin by identifying and labeling the major components
- Code Generation Core: Found in packages/core. Notice that within this folder there are submodules for different languages (solidity, cairo, cairo_alpha, stellar, stylus). Each is responsible for generating and testing contract code for its respective language.
- CI/CD and Deployment: Include the configuration files (GitHub workflows in .github/workflows, Netlify configuration, etc.) that manage deployments, testing, and builds.

##### Architectural patterns and design principles
- Modular Design: The core logic is split into multiple language-specific packages. Represent this using containers or sections clearly segregating “solidity”, “cairo”, “cairo_alpha”, “stellar”, and “stylus”.
- Separation of Concerns: The UI (presentation layer) is separate from the logic (the code generation core). Additionally, testing and configuration are kept in their respective directories.
- Extensibility: Include annotations to note that new languages or components might be added by following the existing patterns.
- CI/CD Integration: Note that configuration files (workflows, scripts, Netlify config) automate testing, compiling, and deploying.

- Svelte for the UI.
- NodeJS/JavaScript/TypeScript as seen from scripts, tests, and configuration files.
- AVA testing framework (as indicated by ava.config.js).
- GitHub Actions (GitHub workflows) and Netlify for deployment.
- For each core package: language-specific tooling (for example, Hardhat configuration in solidity, Scarb in Cairo, etc.).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface Layer"
        UI["UI - Svelte Frontend"]:::ui
        Embed["Embed - <oz-wizard> integration"]:::ui
    end

    subgraph "Code Generation Core"
        Solidity["Core - Solidity Code Generation"]:::core
        Cairo["Core - Cairo Code Generation"]:::core
        CairoAlpha["Core - Cairo Alpha Code Generation"]:::core
        Stellar["Core - Stellar Code Generation"]:::core
        Stylus["Core - Stylus Code Generation"]:::core
    end

    subgraph "DevOps and Configuration"
        CICD["CI/CD & Deployment"]:::cicd
        Config["Supporting Scripts & Configuration"]:::config
    end

    UI -->|"sendsParameters"| Solidity
    UI -->|"sendsParameters"| Cairo
    UI -->|"sendsParameters"| CairoAlpha
    UI -->|"sendsParameters"| Stellar
    UI -->|"sendsParameters"| Stylus

    Solidity -->|"returnsCode"| UI
    Cairo -->|"returnsCode"| UI
    CairoAlpha -->|"returnsCode"| UI
    Stellar -->|"returnsCode"| UI
    Stylus -->|"returnsCode"| UI

    CICD -->|"runsTests"| Solidity
    CICD -->|"runsTests"| Cairo
    CICD -->|"runsTests"| CairoAlpha
    CICD -->|"runsTests"| Stellar
    CICD -->|"runsTests"| Stylus

    Config -->|"configures"| UI
    Config -->|"configures"| Solidity
    Config -->|"configures"| Cairo
    Config -->|"configures"| CairoAlpha
    Config -->|"configures"| Stellar
    Config -->|"configures"| Stylus

    %% Click Events
    click UI "https://github.com/openzeppelin/contracts-wizard/tree/master/packages/ui"
    click Solidity "https://github.com/openzeppelin/contracts-wizard/tree/master/packages/core/solidity"
    click Cairo "https://github.com/openzeppelin/contracts-wizard/tree/master/packages/core/cairo"
    click CairoAlpha "https://github.com/openzeppelin/contracts-wizard/tree/master/packages/core/cairo_alpha"
    click Stellar "https://github.com/openzeppelin/contracts-wizard/tree/master/packages/core/stellar"
    click Stylus "https://github.com/openzeppelin/contracts-wizard/tree/master/packages/core/stylus"
    click CICD "https://github.com/openzeppelin/contracts-wizard/tree/master/.github/workflows"
    click Config "https://github.com/openzeppelin/contracts-wizard/tree/master/scripts/"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef core fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef cicd fill:#FFB6C1,stroke:#000,stroke-width:1px;
    classDef config fill:#FFFFE0,stroke:#000,stroke-width:1px;
```
