# tornadocash/tornado-classic-ui architecture

> Architecture diagram of the GitHub repository tornadocash/tornado-classic-ui, 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/tornadocash/tornado-classic-ui
- Repository: https://github.com/tornadocash/tornado-classic-ui

## Overview

##### Project Overview
- This is a front‐end application (built with Nuxt.js, a Vue.js framework) that serves as the user interface for the Tornado Cash non‑custodial Ethereum privacy solution.
- Its purpose is to allow users to interact with privacy features (deposits, withdrawals, governance interactions, encrypted transactions, etc.) in an Ethereum-based privacy protocol.
- The project also includes mechanisms for managing cached blockchain events (deposits, withdrawals, encrypted notes) and merkle trees.

##### Key Architectural Components (as derived from the file structure and README)
- User Interface (UI) Layer:
- Built using Nuxt.js (see files such as nuxt.config.js, pages/, layouts/, and components/ directories).
- Contains dedicated directories for layouts, pages, and a rich set of Vue components (in components/ and modules/) to render deposit forms, withdrawal modals, governance pages, network selection, etc.
- State Management:
- Utilizes Vuex with a store/ directory that holds state (e.g., store/token.js, store/governance/) and actions/mutations to manage application state.
- Plugins & Middleware:
- Plugins are used to integrate and initialize external libraries (including i18n, clipboard, local storage, IPFS, and wallet connection via web3Connect).
- Middleware files help in provider setup and routing enhancements.
- Service Layer:
- Services (in services/) provide direct interfaces to external systems. For example, services for handling Ethereum event querying, graph queries, merkle tree construction, and cryptographic computations.
- Some service files specifically interact with blockchain data (like events.js, graph.js, lookupAddress.js) and file-based caching (update scripts under scripts/).
- ABIs & Smart Contract Integration:
- The abis/ directory contains JSON files with contract ABIs, indicating that the application communicates with multiple smart contracts (for Aggregator, Governance, ERC20 tokens, etc.).
- Static Assets & Deployment:
- Static folder and Dockerfile indicate that the project can be containerized and deployed as static assets (e.g., on IPFS as mentioned in the README).
- Build & Deployment Scripts:
- Scripts to update event caches and encrypted data (found under scripts/) show a back‑office or helper process for maintaining updated data for deposits/withdrawals.

##### Relationships & Data Flow
- The client (user’s browser) interacts with the Nuxt.js application.
- UI components (in the components/ and modules/ directories) trigger state changes managed by Vuex.
- Vuex actions call methods in the service layer which interact with blockchain networks (via web3, wallet connections) or update data caches using provided scripts.
- Plugins initialize and manage external libraries (for instance, i18n for translations, and IPFS for decentralized deployment).
- Deployment-related scripts and Dockerfile facilitate building the static version of the app and deploying it to IPFS.
- The ABIs ensure that the application can interact with deployed contracts on Ethereum, making contract calls as needed.

##### Architectural Patterns & Technology Highlights
- Separation of Concerns: The application is clearly divided into UI (components, pages, layouts), business logic (Vuex store, modules), and external integrations (services, plugins).
- Modularization: Extensive use of directories for modules (e.g., account, governance) indicates modular development.
- Use of Nuxt.js: Emphasizes server-side rendering and static site generation.
- Integration with Ethereum: Interaction with smart contracts using contract ABI files and services that handle blockchain data.
- Offline/Cached Data Processing: Scripts and services manage updates to local copies of blockchain events and merkle tree data.

## Diagram (Mermaid)

```mermaid
graph TD
    User("Browser/User"):::frontend

    subgraph "Nuxt.js Application"
        UI_PL("UI – Pages/Layout & Components"):::frontend
        UI_Vuex("Vuex Store"):::frontend
        UI_Plugins("Plugins & Middleware"):::integration
    end

    Service_Layer("Service – Blockchain & Data Services"):::integration
    ABIs("ABIs & Smart Contracts"):::external
    Deployment("Static Assets & Deployment"):::external
    Update_Scripts("Update & Maintenance Scripts"):::maintenance
    ExtBlock("Ethereum Network & External Contracts"):::external

    User -->|"loads"| UI_PL
    UI_PL -->|"triggersState"| UI_Vuex
    UI_Plugins -->|"initializes"| UI_Vuex
    UI_Plugins -->|"initiatesWeb3"| Service_Layer
    UI_Vuex -->|"callsService"| Service_Layer
    Service_Layer -->|"queriesBlockchain"| ExtBlock
    Service_Layer -->|"integratesABI"| ABIs
    Service_Layer -->|"deploysTo"| Deployment
    Update_Scripts -->|"updatesData"| Service_Layer

    click UI_PL "https://github.com/tornadocash/tornado-classic-ui/blob/master/nuxt.config.js"
    click UI_Vuex "https://github.com/tornadocash/tornado-classic-ui/tree/master/store/"
    click UI_Plugins "https://github.com/tornadocash/tornado-classic-ui/tree/master/plugins/"
    click Service_Layer "https://github.com/tornadocash/tornado-classic-ui/tree/master/services/"
    click ABIs "https://github.com/tornadocash/tornado-classic-ui/tree/master/abis/"
    click Deployment "https://github.com/tornadocash/tornado-classic-ui/tree/master/static/"
    click Update_Scripts "https://github.com/tornadocash/tornado-classic-ui/tree/master/scripts/"

    classDef frontend fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef integration fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef external fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
    classDef maintenance fill:#FFF9C4,stroke:#F9A825,stroke-width:2px;
```
