# reown-com/appkit architecture

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

- Interactive diagram: https://gitdiagram.com/reown-com/appkit
- Repository: https://github.com/reown-com/appkit

## Overview

##### Project’s Nature and Purpose
- This is a monorepo containing a versatile web3 multichain library (AppKit) along with various supporting demos, examples, and testing apps (such as the laboratory, browser extension, gallery, and demo apps).
- The core goal is to simplify connecting decentralized applications (“Dapps”) with multiple blockchain networks by offering a rich set of adapters, controllers, UI components, and utilities.

##### Break Down the Major Components and Layers
A. User Facing Applications:
- Under the “apps” directory you have multiple apps such as the browser extension, demo, gallery (and “laboratory” for test and experimentation).
- Under “examples” you have numerous client integrations built in different frameworks (React, Next.js, Vue, Nuxt, Svelte, Parcel, etc.) that demonstrate usage.
- These “frontends” are what your end-users and developers work with.

B. Core Library and Business Logic:
- The “packages” folder is the heart of the system. It includes modules like:
– Adapters (for Bitcoin, Ethers, Ethers5, Solana, Wagmi, Polkadot): These modules encapsulate blockchain-specific connection logic.
– AppKit: The central library which ties together adapters, connectors, and provides core methods for integrating with Dapps.
– UI components (packages/ui, packages/scaffold-ui, packages/ui-new): These expose reusable frontend elements.
– Controllers: Business logic controllers that handle account management, connectivity, transactions, theming, and more.
– Common and Utility modules: Shared utilities and contracts that support integration across the board.

C. Services:
- There is at least one “services” component (ex: id-allocation-service) that appears to manage backend work such as identity allocation.

D. Infrastructure & DevOps:
- At the repo root you find CI/CD configuration (CI workflows under “.github/workflows”, changesets configs, etc.), build and release scripts, Dockerfiles, and the monorepo management files (pnpm-workspace.yaml, turbo.json).
- These elements show how the modules are built, tested, versioned, and deployed.

##### Architectural Relationships and Interactions
- The user-facing apps (in “apps” and “examples”) consume the core “AppKit” library along with its UI components.
- The “AppKit” library, in turn, relies on the adapter modules to connect to different blockchains. These adapters abstract the underlying protocols (e.g., Bitcoin, Ethers, Solana) via connectors and provider events.
- Controllers above the adapters coordinate higher-level business logic, such as handling authentication (e.g., SIWE, siwx), managing transactions, or routing events.
- Utility modules underpin these functions with shared constants and helper functions.
- In addition, the testing infrastructure scattered in “tests” directories of many modules validates these interactions.
- Finally, the CI/CD pipeline (via changesets and GitHub workflows) automates building, testing, and releasing new versions.

## Diagram (Mermaid)

```mermaid
graph TD
    %% User Facing Applications
    subgraph "User Facing Applications"
        ext_browser["Browser Extension"]:::user
        demo_app["Demo App"]:::user
        gallery_app["Gallery App"]:::user
        laboratory_app["Laboratory App"]:::user
        examples_app["Client Examples"]:::user
    end

    %% Core Library and Business Logic
    subgraph "Core Library and Business Logic"
        core_appkit["AppKit Core"]:::core
        controllers["Controllers"]:::core
        adapters["Blockchain Adapters"]:::core
        utilities_appkit["AppKit Utils"]:::utils
        utilities_common["Common Modules"]:::utils
    end

    %% UI Components
    subgraph "UI Components"
        ui_new["New UI Components"]:::ui
        ui_old["UI Components"]:::ui
        ui_scaffold["Scaffold UI"]:::ui
    end

    %% Services
    subgraph "Services"
        id_service["ID Allocation Service"]:::services
    end

    %% Infrastructure & DevOps
    subgraph "Infrastructure & DevOps"
        cicd["CI/CD & Automation"]:::infra
        config["Repo Config & Build Files"]:::infra
    end

    %% External Entity
    chains["Blockchain Networks"]:::external

    %% Relationships between components
    ext_browser -->|"consumes"| core_appkit
    demo_app -->|"consumes"| core_appkit
    gallery_app -->|"consumes"| core_appkit
    laboratory_app -->|"consumes"| core_appkit
    examples_app -->|"consumes"| core_appkit

    core_appkit -->|"relies_on"| adapters
    core_appkit -->|"relies_on"| controllers
    core_appkit -->|"integrates_UI"| ui_new
    core_appkit -->|"integrates_UI"| ui_old
    core_appkit -->|"integrates_UI"| ui_scaffold

    controllers -->|"utilizes"| utilities_appkit
    controllers -->|"utilizes"| utilities_common

    adapters -->|"connects_to"| chains

    cicd -->|"automates_build"| ext_browser
    cicd -->|"automates_build"| demo_app
    cicd -->|"automates_build"| gallery_app
    cicd -->|"automates_build"| laboratory_app
    cicd -->|"automates_build"| examples_app
    cicd -->|"automates_build"| core_appkit
    cicd -->|"automates_build"| controllers
    cicd -->|"automates_build"| adapters
    cicd -->|"automates_build"| ui_new
    cicd -->|"automates_build"| id_service

    config -->|"configures"| core_appkit
    config -->|"configures"| controllers
    config -->|"configures"| adapters
    config -->|"configures"| utilities_appkit
    config -->|"configures"| utilities_common
    config -->|"configures"| cicd

    %% Styles for components
    classDef user fill:#f9f,stroke:#333,stroke-width:2px;
    classDef core fill:#bbf,stroke:#333,stroke-width:2px;
    classDef ui fill:#bfb,stroke:#333,stroke-width:2px;
    classDef utils fill:#cfc,stroke:#333,stroke-width:2px;
    classDef services fill:#ffb,stroke:#333,stroke-width:2px;
    classDef infra fill:#fdd,stroke:#333,stroke-width:2px;
    classDef external fill:#ddd,stroke:#333,stroke-width:2px;

    %% Click Events for Component Mapping
    click ext_browser "https://github.com/reown-com/appkit/tree/main/apps/browser-extension"
    click demo_app "https://github.com/reown-com/appkit/tree/main/apps/demo"
    click gallery_app "https://github.com/reown-com/appkit/tree/main/apps/gallery"
    click laboratory_app "https://github.com/reown-com/appkit/tree/main/apps/laboratory"
    click core_appkit "https://github.com/reown-com/appkit/tree/main/packages/appkit"
    click adapters "https://github.com/reown-com/appkit/tree/main/packages/adapters"
    click controllers "https://github.com/reown-com/appkit/tree/main/packages/controllers"
    click utilities_appkit "https://github.com/reown-com/appkit/tree/main/packages/appkit-utils"
    click utilities_common "https://github.com/reown-com/appkit/tree/main/packages/common"
    click ui_new "https://github.com/reown-com/appkit/tree/main/packages/ui-new"
    click ui_old "https://github.com/reown-com/appkit/tree/main/packages/ui"
    click ui_scaffold "https://github.com/reown-com/appkit/tree/main/packages/scaffold-ui"
    click id_service "https://github.com/reown-com/appkit/tree/main/services/id-allocation-service"
    click cicd "https://github.com/reown-com/appkit/tree/main/.github/workflows"
    click config "https://github.com/reown-com/appkit/blob/main/pnpm-workspace.yaml"
```
