# tuanha203/madworld architecture

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

- Interactive diagram: https://gitdiagram.com/tuanha203/madworld
- Repository: https://github.com/tuanha203/madworld

## Overview

##### Project type and purpose
- This is a web-based NFT marketplace UI built with Next.js (React).
- It integrates with Ethereum-style blockchains (via JSON-RPC), IPFS, and third-party services (eg. Coingecko).
- It uses Redux for client state, Next.js pages for routing/SSR, and custom API endpoints under pages/api.

##### File structure
- Top level: configuration files (.env, Dockerfile, Makefile, buildspec.yml), devops scripts, docker-compose.
- src/pages/: Next.js page routes + minimal API (healthcheck).
- src/components/: React UI broken into common, layout, modules, templates, web3 provider.
- src/blockchain/: network connector, Ethers wrapper, IPFS helper, RPC utilities.
- src/service/, src/request/: service layer with Axios clients for REST/GraphQL, customAxios.
- src/store/: Redux actions, reducers, configureStore and redux-persist storage.
- src/hooks/, src/utils/: custom React hooks and utility functions.
- src/config/, src/constants/: app-wide configuration and constants.
- devops/: CI/CD and AWS CodeBuild buildspecs.

##### README for additional insights
- Confirms Next.js and React as core.
- No separate backend code aside from Next.js API route.
- Deployment via Docker and buildspec.yml for CodeBuild (AWS).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client (Browser)"
        Browser["Browser / React UI"]:::frontend
        Redux["Redux Store"]:::logic
        Web3["Web3 Layer"]:::logic
        Service["Service Layer"]:::logic
    end

    subgraph "Server (Next.js)"
        NextServer["Next.js Server (SSR + API)"]:::logic
        Healthcheck["/api/healthcheck"]:::logic
    end

    subgraph "External Systems"
        Blockchain["Blockchain Networks (RPC)"]:::external
        IPFS["IPFS Gateway"]:::external
        ThirdParty["Third-Party APIs (Coingecko, Analytics)"]:::external
        Static["Static Asset Storage (public/)"]:::external
        DevOps["CI/CD & DevOps Pipeline"]:::infra
    end

    Browser -->|SSR requests| NextServer
    NextServer -->|renders pages / hydration| Browser
    Browser -->|dispatch actions| Redux
    Redux -->|state updates| Browser
    Browser -->|connect/disconnect| Web3
    Web3 -->|JSON-RPC calls| Blockchain
    Blockchain -->|metadata pointers| IPFS
    Browser -->|HTTP requests| Service
    Service -->|REST/GraphQL calls| ThirdParty
    DevOps -->|builds Docker image| NextServer
    DevOps -->|deploys static| Static

    click Browser "https://github.com/tuanha203/madworld/tree/main/src/components/"
    click NextServer "https://github.com/tuanha203/madworld/tree/main/src/pages/"
    click Healthcheck "https://github.com/tuanha203/madworld/blob/main/src/pages/api/healthcheck.js"
    click Redux "https://github.com/tuanha203/madworld/blob/main/src/store/configureStore.ts"
    click Redux "https://github.com/tuanha203/madworld/tree/main/src/store/actions/"
    click Redux "https://github.com/tuanha203/madworld/tree/main/src/store/reducers/"
    click Web3 "https://github.com/tuanha203/madworld/blob/main/src/components/web3/Web3ReactManager.tsx"
    click Web3 "https://github.com/tuanha203/madworld/blob/main/src/components/web3/Web3ProviderNetwork.tsx"
    click Web3 "https://github.com/tuanha203/madworld/blob/main/src/blockchain/NetworkConnector.ts"
    click Web3 "https://github.com/tuanha203/madworld/blob/main/src/blockchain/connectors.ts"
    click Web3 "https://github.com/tuanha203/madworld/blob/main/src/blockchain/ether.ts"
    click Web3 "https://github.com/tuanha203/madworld/blob/main/src/blockchain/rpc.ts"
    click Web3 "https://github.com/tuanha203/madworld/blob/main/src/blockchain/ipfs.ts"
    click Service "https://github.com/tuanha203/madworld/blob/main/src/request/customAxios.ts"
    click Service "https://github.com/tuanha203/madworld/blob/main/src/request/index.ts"
    click Service "https://github.com/tuanha203/madworld/tree/main/src/service/"
    click DevOps "https://github.com/tuanha203/madworld/tree/main/Dockerfile"
    click DevOps "https://github.com/tuanha203/madworld/blob/main/docker-compose.yml"
    click DevOps "https://github.com/tuanha203/madworld/blob/main/buildspec.yml"
    click DevOps "https://github.com/tuanha203/madworld/tree/main/devops/"

    classDef frontend fill:#D6EAF8,stroke:#3498DB,color:#1B4F72
    classDef logic fill:#D5F5E3,stroke:#27AE60,color:#1D8348
    classDef external fill:#FADBD8,stroke:#E74C3C,color:#922B21
    classDef infra fill:#FCF3CF,stroke:#F1C40F,color:#7D6608
```
