# zkmopro/mopro architecture

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

- Interactive diagram: https://gitdiagram.com/zkmopro/mopro
- Repository: https://github.com/zkmopro/mopro

## Overview

##### Main Components Structure

A. Client Applications Layer (Top)
- Mobile Apps (iOS/Android)
- Web Applications
- Flutter Applications
- React Native Applications

B. Core Integration Layer (Middle)
- Mopro FFI (Foreign Function Interface)
- Mopro WASM (WebAssembly Interface)

C. ZK Proving Layer (Bottom)
- Circom Adapter
- Halo2 Adapter

##### Component Relationships

- Double lines: Data flow paths

##### Detailed Component Breakdown

Frontend Implementations:
**┌─────────────────────────────────────────┐**
- Client Applications          │
- ┬─────────┬─────────┬─────────┤
- Android │  iOS    │  Web    │ Flutter │
- ┴─────────┴─────────┴─────────┘

Integration Layer:
**┌─────────────────────────────────────────┐**
- Integration Interfaces          │
- ┬─────────────────┤
- Mopro FFI       │   Mopro WASM    │
- (Mobile Native)    │  (Web Browser)   │
- ┴─────────────────┘

ZK Proving Layer:
**┌─────────────────────────────────────────┐**
- ZK Proving Engines           │
- ┬─────────────────┤
- Circom Adapter     │  Halo2 Adapter  │
- ┴─────────────────┘

##### Additional Elements

Supporting components:
- Test vectors repository
- Documentation system
- CLI tools
- Configuration management

##### Performance Indicators

A side panel showing performance metrics from the README:
- Circom performance comparisons
- Halo2 performance metrics
- Platform-specific benchmarks

##### Implementation Details

Technical aspects:
- Rust/FFI bindings
- WASM compilation pipeline
- Mobile platform integration points
- Test infrastructure

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef client fill:#3498db,stroke:#2980b9,color:white
    classDef integration fill:#2ecc71,stroke:#27ae60,color:white
    classDef zkprover fill:#e67e22,stroke:#d35400,color:white
    classDef support fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef dataflow fill:#9b59b6,stroke:#8e44ad,color:white

    %% Client Applications Layer
    subgraph ClientLayer["Client Applications Layer"]
        Android["Android App"]:::client
        iOS["iOS App"]:::client
        Web["Web App"]:::client
        Flutter["Flutter App"]:::client
    end

    %% Integration Layer
    subgraph IntegrationLayer["Integration Layer"]
        FFI["Mopro FFI"]:::integration
        WASM["Mopro WASM"]:::integration
        WASMLib["WASM Library"]:::integration
    end

    %% ZK Proving Layer
    subgraph ZKLayer["ZK Proving Layer"]
        Circom["Circom Adapter"]:::zkprover
        Halo2["Halo2 Adapter"]:::zkprover
    end

    %% Support Components
    subgraph SupportLayer["Support Infrastructure"]
        TestVectors["Test Vectors"]:::support
        Docs["Documentation"]:::support
        CLI["CLI Tools"]:::support
        E2ETests["E2E Tests"]:::support
    end

    %% Relationships
    Android --> FFI
    iOS --> FFI
    Web --> WASM
    Flutter --> FFI
    Flutter --> WASM

    FFI --> Circom
    FFI --> Halo2
    WASM --> WASMLib
    WASMLib --> Circom
    WASMLib --> Halo2

    CLI --> TestVectors
    E2ETests --> FFI
    E2ETests --> WASM

    %% Click Events
    click FFI "https://github.com/zkmopro/mopro/tree/main/mopro-ffi/"
    click WASM "https://github.com/zkmopro/mopro/tree/main/mopro-wasm/"
    click Circom "https://github.com/zkmopro/mopro/tree/main/mopro-ffi/src/circom/"
    click Halo2 "https://github.com/zkmopro/mopro/tree/main/mopro-ffi/src/halo2/"
    click Android "https://github.com/zkmopro/mopro/tree/main/cli/src/template/android/"
    click iOS "https://github.com/zkmopro/mopro/tree/main/cli/src/template/ios/"
    click Web "https://github.com/zkmopro/mopro/tree/main/cli/src/template/web/"
    click TestVectors "https://github.com/zkmopro/mopro/tree/main/test-vectors/"
    click Docs "https://github.com/zkmopro/mopro/tree/main/docs/"
    click CLI "https://github.com/zkmopro/mopro/tree/main/cli/"
    click WASMLib "https://github.com/zkmopro/mopro/tree/main/cli/src/template/mopro-wasm-lib/"
    click E2ETests "https://github.com/zkmopro/mopro/tree/main/test-e2e/"

    %% Legend
    subgraph Legend
        Client["Client Apps"]:::client
        Int["Integration Layer"]:::integration
        ZK["ZK Provers"]:::zkprover
        Sup["Support Tools"]:::support
    end
```
