# talismansociety/talisman architecture

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

- Interactive diagram: https://gitdiagram.com/talismansociety/talisman
- Repository: https://github.com/talismansociety/talisman

## Overview

##### Main Components Structure

The system should be divided into these major components:

**A. Extension Core (Background Service)**
- Account Management
- Cryptographic Operations
- State Management
- Network Communications

**B. User Interface Layer**
- Popup Interface
- Dashboard Interface
- Onboarding Flow

**C. External Integrations**
- Blockchain Networks
- Token Services
- Price Feeds

##### Detailed Component Breakdown

**A. Extension Core:**
- Background Scripts
- State Management
- Security Layer
- Chain Connectors
- Balance Tracking
- Transaction Handling

**B. User Interface:**
- Account Management UI
- Transaction Signing
- Portfolio View
- Settings Management
- Network Management

**C. Data Layer:**
- Local Storage
- IndexedDB
- State Stores
- Cache Management

##### Connection Flows

**⇄ Bi-directional Communication**

- Core Services: Blue
- UI Components: Green
- External Services: Orange
- Security Components: Red
- Data Storage: Purple

##### Implementation Details

Technical stack information:

- TypeScript/React for UI
- Background Services
- Chain Connectors
- State Management
- Security Layer

##### Key Features to Highlight

Create special indicators for:

- Multi-chain Support
- Hardware Wallet Integration
- Token Management
- Transaction Signing
- Account Management

##### External Integrations

Connections to:

- Ethereum Networks
- Polkadot Networks
- Price Feeds
- Token Services

##### Security Boundaries

Clearly mark:

- Secure Storage Areas
- Encryption Boundaries
- Permission Boundaries
- External Communication Points

##### The architecture is scalable

This structure reflects the monorepo organization shown in the file tree, with special attention to the extension core functionality and its interaction with various blockchain networks.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef ui fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef external fill:#FFA500,stroke:#333,stroke-width:2px
    classDef security fill:#FFB6C1,stroke:#333,stroke-width:2px
    classDef data fill:#DDA0DD,stroke:#333,stroke-width:2px

    %% UI Layer
    subgraph UI
        PopupUI["Popup Interface"]:::ui
        DashboardUI["Dashboard Interface"]:::ui
        OnboardingUI["Onboarding Flow"]:::ui
        UIComponents["UI Components"]:::ui
    end

    %% Core Layer
    subgraph Core
        BackgroundService["Background Service"]:::core
        AccountMgmt["Account Management"]:::core
        StateMgmt["State Management"]:::core
        NetworkComm["Network Communications"]:::core
        TxHandler["Transaction Handler"]:::core
    end

    %% Security Layer
    subgraph Security
        Encryption["Encryption"]:::security
        PasswordMgmt["Password Management"]:::security
    end

    %% Data Layer
    subgraph Data
        Database["Database"]:::data
        StateStores["State Stores"]:::data
    end

    %% Chain Support
    subgraph Chains
        EthereumSupport["Ethereum Support"]:::core
        SubstrateSupport["Substrate Support"]:::core
    end

    %% Asset Management
    subgraph Assets
        BalanceTracker["Balance Tracking"]:::core
        NFTSupport["NFT Support"]:::core
        TokenRates["Token Rates"]:::core
    end

    %% External Services
    subgraph External
        ChainConnector["Chain Connector"]:::external
        TokenServices["Token Services"]:::external
        PriceFeeds["Price Feeds"]:::external
    end

    %% Relationships
    UI --> BackgroundService
    BackgroundService --> AccountMgmt
    BackgroundService --> StateMgmt
    BackgroundService --> NetworkComm
    BackgroundService --> Security
    AccountMgmt --> Database
    StateMgmt --> StateStores
    NetworkComm --> ChainConnector
    ChainConnector --> EthereumSupport
    ChainConnector --> SubstrateSupport
    TxHandler --> ChainConnector
    Assets --> TokenServices
    Assets --> PriceFeeds

    %% Click Events
    click PopupUI "https://github.com/TalismanSociety/talisman/tree/dev/apps/extension/src/ui/apps/popup/"
    click DashboardUI "https://github.com/TalismanSociety/talisman/tree/dev/apps/extension/src/ui/apps/dashboard/"
    click OnboardingUI "https://github.com/TalismanSociety/talisman/tree/dev/apps/extension/src/ui/apps/onboard/"
    click UIComponents "https://github.com/TalismanSociety/talisman/tree/dev/apps/extension/src/@talisman/components/"
    click BackgroundService "https://github.com/TalismanSociety/talisman/blob/dev/packages/extension-core/src/background.ts"
    click AccountMgmt "https://github.com/TalismanSociety/talisman/tree/dev/packages/extension-core/src/domains/accounts/"
    click StateMgmt "https://github.com/TalismanSociety/talisman/tree/dev/packages/extension-core/src/domains/"
    click NetworkComm "https://github.com/TalismanSociety/talisman/tree/dev/packages/extension-core/src/handlers/"
    click Encryption "https://github.com/TalismanSociety/talisman/tree/dev/packages/extension-core/src/domains/encrypt/"
    click PasswordMgmt "https://github.com/TalismanSociety/talisman/blob/dev/packages/extension-core/src/domains/app/store.password.ts"
    click Database "https://github.com/TalismanSociety/talisman/tree/dev/packages/extension-core/src/db/"
    click StateStores "https://github.com/TalismanSociety/talisman/blob/dev/packages/extension-core/src/domains/*/store.*"
    click EthereumSupport "https://github.com/TalismanSociety/talisman/tree/dev/packages/extension-core/src/domains/ethereum/"
    click SubstrateSupport "https://github.com/TalismanSociety/talisman/tree/dev/packages/extension-core/src/domains/substrate/"
    click BalanceTracker "https://github.com/TalismanSociety/talisman/tree/dev/packages/balances/"
    click NFTSupport "https://github.com/TalismanSociety/talisman/tree/dev/packages/extension-core/src/domains/nfts/"
    click TokenRates "https://github.com/TalismanSociety/talisman/tree/dev/packages/token-rates/"
    click ChainConnector "https://github.com/TalismanSociety/talisman/tree/dev/packages/chain-connector/"
    click TokenServices "https://github.com/TalismanSociety/talisman/tree/dev/packages/balances/"
    click PriceFeeds "https://github.com/TalismanSociety/talisman/tree/dev/packages/token-rates/"
    click TxHandler "https://github.com/TalismanSociety/talisman/tree/dev/packages/extension-core/src/domains/transactions/"

    %% Legend
    subgraph Legend
        UI_Legend["UI Components"]:::ui
        Core_Legend["Core Components"]:::core
        External_Legend["External Services"]:::external
        Security_Legend["Security Components"]:::security
        Data_Legend["Data Components"]:::data
    end
```
