# ascendia-network/app-food-market architecture

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

- Interactive diagram: https://gitdiagram.com/ascendia-network/app-food-market
- Repository: https://github.com/ascendia-network/app-food-market

## Overview

##### Project type and purpose
- This is a single-page, full-stack dApp (decentralized application) written in React/Redux that implements a food marketplace on the Ambrosus (Ethereum) protocol.
- It has no traditional backend server—business logic, state management, and blockchain calls all happen in the browser via Web3. Static assets are bundled by Webpack and served from the `dist` folder.

##### File structure
- Top-level directories:
– src/
· components/ (React components split into HOCs and stateless/generic/specific)
· redux/ (actions, reducers, store configuration)
· utils/ (blockchain & IPFS helpers, validators, retry logic)
· static/, index.html
· app.js (entry point)
– dist/ (production build output)
– designs/ (UI mockups)
– webpack.config.js, package.json, etc.
- Patterns:
– React/Redux for UI and state
– Higher-order components for cross-cutting UI concerns
– Stateless components for visual elements
– Utility modules for Web3, IPFS, transaction building, and event listening
- Deployment config: bundled via Webpack into `dist/static`, served as a static SPA; dev-server script for local development.

##### README
- Describes purpose: “Food marketplace application based on Ambrosus protocol.”
- Running instructions: npm install, dev-server, requirement for a running Ethereum node (Parity recommended)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend Layer"
        direction TB
        App["Entry Point (app.js)"]:::frontend
        Root["Root Component"]:::frontend
        HOC["Higher-Order Components"]:::frontend
        Gen["Stateless Generic Components"]:::frontend
        Spec["Stateless Specific Components"]:::frontend
    end

    subgraph "State Layer (Redux)"
        direction TB
        Actions["Redux Actions"]:::frontend
        Reducers["Redux Reducers"]:::frontend
        Store["Redux Store"]:::frontend
    end

    subgraph "Blockchain Layer"
        direction TB
        Web3Init["Web3 & Ambrosus Init"]:::frontend
        TxBuilder["Transaction Builder"]:::frontend
        Events["Event Listener Bridge"]:::frontend
    end

    subgraph "IPFS Utilities"
        direction TB
        LoadIPFS["Load from IPFS"]:::frontend
        WithIPFS["HOC for IPFS-backed Components"]:::frontend
    end

    subgraph "External Services"
        direction TB
        ETH["Ethereum Node (Ambrosus)"]:::external
        IPFSNode["IPFS Node"]:::external
        User["User"]:::external
    end

    subgraph "Artifacts"
        direction TB
        Dist["Static Assets (dist/static)"]:::artifact
        Webpack["Build Config (webpack.config.js)"]:::artifact
        Meta["Project Metadata (package.json)"]:::artifact
    end

    User -->|"interacts with"| Root
    Root -->|"wraps UI via"| HOC
    HOC -->|"renders children"| Gen
    HOC -->|"renders children"| Spec
    Root -->|"boots via"| App
    App -->|"dispatches actions"| Actions
    Actions -->|"handled by"| Reducers
    Reducers -->|"update"| Store
    Store -->|"invokes"| Web3Init
    Web3Init -->|"builds tx via"| TxBuilder
    TxBuilder -->|"sends transaction"| ETH
    ETH -->|"emits events"| Events
    Events -->|"dispatches"| Actions
    Store -->|"provides state to"| Root
    Spec -->|"requests off-chain data"| LoadIPFS
    Spec -->|"enhanced by"| WithIPFS
    LoadIPFS -->|"fetches from"| IPFSNode
    WithIPFS -->|"fetches from"| IPFSNode

    Webpack -->|"bundles to"| Dist
    Meta -->|"defines scripts for"| Webpack
    Dist -->|"served to"| User

    click App "https://github.com/ascendia-network/app-food-market/blob/master/src/app.js"
    click Root "https://github.com/ascendia-network/app-food-market/blob/master/src/components/RootComponent.jsx"
    click HOC "https://github.com/ascendia-network/app-food-market/tree/master/src/components/hoc/"
    click Gen "https://github.com/ascendia-network/app-food-market/tree/master/src/components/stateless/generic/"
    click Spec "https://github.com/ascendia-network/app-food-market/tree/master/src/components/stateless/specific/"
    click Actions "https://github.com/ascendia-network/app-food-market/tree/master/src/redux/actions/"
    click Reducers "https://github.com/ascendia-network/app-food-market/tree/master/src/redux/reducers/"
    click Store "https://github.com/ascendia-network/app-food-market/blob/master/src/redux/stores/store.js"
    click Web3Init "https://github.com/ascendia-network/app-food-market/blob/master/src/utils/waitForWeb3.js"
    click TxBuilder "https://github.com/ascendia-network/app-food-market/blob/master/src/utils/transactionBuilder.js"
    click Events "https://github.com/ascendia-network/app-food-market/blob/master/src/utils/blockchainEvents.js"
    click LoadIPFS "https://github.com/ascendia-network/app-food-market/blob/master/src/utils/loadFromIPFS.js"
    click WithIPFS "https://github.com/ascendia-network/app-food-market/blob/master/src/utils/withIPFS.js"
    click Dist "https://github.com/ascendia-network/app-food-market/tree/master/dist/static/"
    click Webpack "https://github.com/ascendia-network/app-food-market/blob/master/webpack.config.js"
    click Meta "https://github.com/ascendia-network/app-food-market/blob/master/package.json"

    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef external fill:#d4edda,stroke:#333,stroke-width:1px
    classDef artifact fill:#ffe5b4,stroke:#333,stroke-width:1px
```
