# sowdarjya/ethpay architecture

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

- Interactive diagram: https://gitdiagram.com/sowdarjya/ethpay
- Repository: https://github.com/sowdarjya/ethpay

## Overview

##### Project type and purpose
- EthPay is a full-stack decentralized application (dApp) whose purpose is to let users send ETH on Ethereum with custom messages and keywords.
- The “client” folder contains a React + TailwindCSS frontend, and the “smart_contract” folder contains the Solidity contract, Hardhat config, tests, and deployment scripts.

##### File structure
- Top level splits clearly into two subprojects:
- client/ — React single­page app (components, context, utils, public)
- smart_contract/ — Solidity code (contracts/), tests/, deployment scripts/, artifacts/
- Build & config artifacts: vite.config.js, Hardhat config, package.json in each module
- Context provider in client/src/context handles wallet connection and ethers.js logic
- scripts/deploy.js uses Hardhat to deploy to a network (e.g., Sepolia)

##### README for additional insights
- Stack: React, TailwindCSS, ethers.js, Solidity, Hardhat
- External dependencies: Ethereum wallet extension (MetaMask), Infura/Alchemy node provider, GIPHY API
- Workflow: developer deploys contract, updates address in client/constants, runs client

##### Essential architectural details
- You capture:
- How the React Context abstracts ethers.js calls
- The contract’s public functions (e.g., sendTransaction) and emitted events
- Wallet signing flow via MetaMask
- Deployment pipeline via Hardhat
- Real-time UI updates from blockchain events

## Diagram (Mermaid)

```mermaid
flowchart TD
    user([User]):::user_icon

    subgraph "Frontend (React SPA)"
        direction TB
        UI["React Components"]:::frontend
        Context["TransactionContext"]:::frontend
        Utils["ABI & Constants"]:::frontend
        Styles["Styles & Build Config"]:::frontend
    end

    subgraph "Blockchain & Deployment"
        direction TB
        SC["Smart Contract (Transactions.sol)"]:::blockchain
        Hardhat["Hardhat Scripts & Config"]:::blockchain
        Tests["Contract Tests"]:::blockchain
        Artifacts["Compiled Artifacts"]:::blockchain
        Cache["Compilation Cache"]:::blockchain
        Network("Ethereum Network"):::external
    end

    Giphy("GIPHY API"):::external
    MetaMask("MetaMask (Wallet)"):::external

    user -->|"interacts with"| UI
    UI -->|"calls context methods"| Context
    Context -->|"uses ABI & Address"| Utils
    Context -->|"imports styles/build config"| Styles
    Context -->|"sendTransaction()"| MetaMask
    MetaMask -->|"signed tx"| Network
    Context -->|"query & listen"| Network
    Network -->|"event: Transfer"| Context
    Context -.->|"GET /gifs"| Giphy
    Hardhat -->|"deploys contract"| Network
    Hardhat -->|"produces artifacts"| Artifacts
    Hardhat -->|"creates cache"| Cache
    Artifacts -->|"ABI JSON"| Utils
    Tests -->|"run tests against"| SC

    click UI "https://github.com/sowdarjya/ethpay/tree/main/client/src/components/"
    click Context "https://github.com/sowdarjya/ethpay/blob/main/client/src/context/TransactionContext.jsx"
    click Utils "https://github.com/sowdarjya/ethpay/blob/main/client/src/utils/Transactions.json"
    click Utils "https://github.com/sowdarjya/ethpay/blob/main/client/src/utils/constants.js"
    click Styles "https://github.com/sowdarjya/ethpay/blob/main/client/src/index.css"
    click Styles "https://github.com/sowdarjya/ethpay/blob/main/client/vite.config.js"
    click SC "https://github.com/sowdarjya/ethpay/blob/main/smart_contract/contracts/Transactions.sol"
    click Hardhat "https://github.com/sowdarjya/ethpay/blob/main/smart_contract/hardhat.config.js"
    click Hardhat "https://github.com/sowdarjya/ethpay/blob/main/smart_contract/scripts/deploy.js"
    click Tests "https://github.com/sowdarjya/ethpay/blob/main/smart_contract/test/Transactions.js"
    click Artifacts "https://github.com/sowdarjya/ethpay/tree/main/smart_contract/artifacts/"
    click Cache "https://github.com/sowdarjya/ethpay/blob/main/smart_contract/cache/solidity-files-cache.json"

    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef blockchain fill:#90EE90,stroke:#000,stroke-width:1px
    classDef external fill:#FFA500,stroke:#000,stroke-width:1px
    classDef user_icon fill:#FFFFFF,stroke:#000,stroke-width:1px,font-weight:bold
```
