# amenetwork/ame architecture

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

- Interactive diagram: https://gitdiagram.com/amenetwork/ame
- Repository: https://github.com/amenetwork/ame

## Overview

##### Ame World – which handles component management and user registration across chains.
2. Ame Component – which defines a standardized interface (IComponent) that allows developers to create custom, composable social features (e.g., profiles, badges, blogs, etc.) onchain.

##### Main Components
- Ame World Contract: Represent the contract responsible for user registration, adding/removing components, and retrieving components.
- Ame Component Interface (IComponent): This defines the standardized methods for component interactions (get, post, put, options, etc.). Include a sample component (like the Profiles example) to show how methods like getUser, createUser, and updateUserName are implemented.
- External Systems & Chains: Since Ame World is deployed on multiple chains (OP Sepolia, Base Sepolia, etc.), include representations for the blockchains (or nodes/chains) where these contracts are deployed. Optionally, show links to external clients (front-end applications or SDKs) interacting with the contracts.
- Developer Tools/Scripts: Briefly note the existence of additional tooling (for example, the Ame Javascript SDK) which can be depicted as an integration point with the onchain contracts.

- That once users add components, those components (being smart contracts that implement IComponent) handle various request types (GET, POST, PUT) and data operations.
- That components interact with user data onchain, with calls from the client possibly going through the SDK which encodes/decodes parameters.
- Interdependencies such as how the Ame World contract queries the specific component contracts to verify if a component is registered for a user.

##### Architectural Patterns and Design Principles
- Modularity/Composability: Emphasize how components are built to a standard interface (IComponent) which promotes plug-and-play extensibility.
- Encapsulation of Request Methods: Illustrate that each component encapsulates the request methods (get, post, put, options) along with their dynamic encoding/decoding capabilities.

##### Relevant Technologies
- Solidity for smart contract development.
- Ethereum-based blockchains (specific chains as listed in the README).
- The JavaScript SDK that developers use to interact with the contracts (for encoding request parameters and decoding responses).
- Mention any standardized interfaces (such as EIP-7654 related to method types) and how they fit into the overall system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Management Layer
    subgraph "Management Layer"
        UserClient["User Client/SDK"]:::sdk
        World["Ame World Contract\n(Management)"]:::management
    end

    %% Component Layer
    subgraph "Ame Components (Component Layer)"
        IComp["IComponent Interface\n(Standardized Methods)"]:::component
        subgraph "Individual Components"
            Badge["AmeBadge Component"]:::component
            Blog["AmeBlog Component"]:::component
            Card["AmeCard Component"]:::component
            Feed["AmeFeed Component"]:::component
            Keypair["AmeKeypair Component"]:::component
            AvatarComp["Avatar Component"]:::component
            EventComp["EventComponent Component"]:::component
            JutsuComp["Jutsu Component"]:::component
            TagsComp["Tags Component"]:::component
            VibeComp["Vibe Component"]:::component
            VibeCommentComp["VibeComment Component"]:::component
            VibeProfilesComp["VibeProfiles Component\n(Profiles Example)"]:::component
        end
    end

    %% Interactions
    UserClient -->|"register/manage"| World
    World -->|"queries"| IComp
    IComp -->|"implements"| Badge
    IComp -->|"implements"| Blog
    IComp -->|"implements"| Card
    IComp -->|"implements"| Feed
    IComp -->|"implements"| Keypair
    IComp -->|"implements"| AvatarComp
    IComp -->|"implements"| EventComp
    IComp -->|"implements"| JutsuComp
    IComp -->|"implements"| TagsComp
    IComp -->|"implements"| VibeComp
    IComp -->|"implements"| VibeCommentComp
    IComp -->|"implements"| VibeProfilesComp

    %% Click Events
    click World "https://github.com/amenetwork/ame/tree/main/contracts/Ame"
    click IComp "https://github.com/amenetwork/ame/tree/main/contracts/Components/Example"
    click Badge "https://github.com/amenetwork/ame/tree/main/contracts/Components/AmeBadge"
    click Blog "https://github.com/amenetwork/ame/tree/main/contracts/Components/AmeBlog"
    click Card "https://github.com/amenetwork/ame/tree/main/contracts/Components/AmeCard"
    click Feed "https://github.com/amenetwork/ame/tree/main/contracts/Components/AmeFeed"
    click Keypair "https://github.com/amenetwork/ame/tree/main/contracts/Components/AmeKeypair"
    click AvatarComp "https://github.com/amenetwork/ame/tree/main/contracts/Components/Avatar"
    click EventComp "https://github.com/amenetwork/ame/tree/main/contracts/Components/EventComponent"
    click JutsuComp "https://github.com/amenetwork/ame/tree/main/contracts/Components/Jutsu"
    click TagsComp "https://github.com/amenetwork/ame/tree/main/contracts/Components/Tags"
    click VibeComp "https://github.com/amenetwork/ame/tree/main/contracts/Components/Vibe"
    click VibeCommentComp "https://github.com/amenetwork/ame/tree/main/contracts/Components/VibeComment"
    click VibeProfilesComp "https://github.com/amenetwork/ame/tree/main/contracts/Components/VibeProfiles"

    %% Styles
    classDef management fill:#f9d6a5,stroke:#333,stroke-width:2px;
    classDef component fill:#d5f8d5,stroke:#333,stroke-width:2px;
    classDef sdk fill:#cce5ff,stroke:#333,stroke-width:2px;
```
