# adrianhajdin/project_crowdfunding architecture

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

- Interactive diagram: https://gitdiagram.com/adrianhajdin/project_crowdfunding
- Repository: https://github.com/adrianhajdin/project_crowdfunding

## Overview

##### Project Type and Purpose
- The project is a decentralized crowdfunding platform built on Web3, where users can create and fund campaigns through blockchain-based smart contracts.
- The README highlights this as the first blockchain application experience focused on building and deploying a Web3 crowdfunding platform.

##### File Structure
- The project is split into two key parts:
- The “client” directory: Contains a React-based frontend application (code, pages, components, context, utilities, and configuration files like Vite and Tailwind).
- The “web3” directory: Contains blockchain-related code such as smart contract files (within “contracts”), a Hardhat configuration file (for managing and testing smart contracts), and its package configuration.
- This separation clearly indicates an architecture with a dedicated front-end application and a blockchain/smart contract backend (using Hardhat for deployment and testing).

##### Main Components
a. Frontend (Client Application):
- React components (pages and reusable UI components like Navbar, FormField, FundCard, etc.).
- Context and utilities used to manage state and interactions.
- Use of tools like Vite for development and Tailwind CSS for styling.
- Routing and page structure (Home, Profile, CreateCampaign, CampaignDetails).

b. Blockchain/Smart Contracts (Web3):
- Smart contracts developed within the “web3/contracts” directory.
- Interactions where the client sends transactions and calls smart contract functions.

c. Interaction and Connectivity:
- Optionally, note any external dependencies such as wallets (e.g., MetaMask) and blockchain networks (e.g., Ethereum).

##### Architectural Patterns and Design Principles
- Separation of concerns: A clear division between the decentralized backend (smart contracts) and the rich client-side UI.
- Modular design: The frontend is broken down into pages, components, constants, context, and utilities, simplifying maintenance and extensibility.
- Integration through standard Web3 patterns: The client interacts with smart contracts via Web3 providers, ensuring secure transactional flows.

##### Elements
- From the Frontend (React) to the Blockchain (via web3 calls)
- From UI events (clicks, form submissions) triggering contract interactions.
- Another for smart contract elements (e.g., circles or hexagons representing blockchain nodes or contracts)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "React Frontend"
        P["Pages (Home,CreateCampaign)"]:::frontend
        C["UI Components (Navbar,FundCard)"]:::frontend
        S["State & Context"]:::frontend
        U["Utilities"]:::frontend
        X["Constants"]:::frontend
        V["Vite Config"]:::config
        T["Tailwind Config"]:::config
    end

    subgraph "Blockchain Layer"
        B["Smart Contracts"]:::blockchain
        H["Hardhat Environment"]:::blockchain
    end

    E["External Services (Wallets&Networks)"]:::external

    S -->|"StateUpdate"| P
    U -->|"UtilityFuncs"| P
    X -->|"ConstUsage"| P
    V -.->|"BuildConfig"| C
    T -.->|"Styling"| C
    P -->|"SmartContractCalls"| B
    P -->|"ConnectsTo"| E
    E -->|"TxSignConfirm"| B

    click P "https://github.com/adrianhajdin/project_crowdfunding/tree/master/client/src/pages"
    click C "https://github.com/adrianhajdin/project_crowdfunding/tree/master/client/src/components"
    click S "https://github.com/adrianhajdin/project_crowdfunding/tree/master/client/src/context"
    click U "https://github.com/adrianhajdin/project_crowdfunding/tree/master/client/src/utils"
    click X "https://github.com/adrianhajdin/project_crowdfunding/tree/master/client/src/constants"
    click V "https://github.com/adrianhajdin/project_crowdfunding/blob/master/client/vite.config.js"
    click T "https://github.com/adrianhajdin/project_crowdfunding/blob/master/client/tailwind.config.js"
    click B "https://github.com/adrianhajdin/project_crowdfunding/tree/master/web3/contracts"
    click H "https://github.com/adrianhajdin/project_crowdfunding/blob/master/web3/hardhat.config.js"

    classDef frontend fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
    classDef blockchain fill:#FFCDD2,stroke:#B71C1C,stroke-width:2px;
    classDef external fill:#C8E6C9,stroke:#1B5E20,stroke-width:2px;
    classDef config fill:#FFF9C4,stroke:#F57F17,stroke-width:2px;
```
