How faizack/supply-chain-blockchain works
Project type and purpose
• This is a full-stack Ethereum DApp for supply-chain management.
• Frontend: React application (client/)
• Blockchain backend: Solidity smart contract (contracts/) deployed via Truffle (migrations/) to a testnet (Gode Testnet or Ganache).
• Web3.js & MetaMask provide the bridge between frontend and blockchain.
File structure
• client/: React-based user interface
– src/: React components (AddMed.js, AssignRoles.js, Supply.js, Track.js, Home.js, App.js)
– artifacts/: compiled ABI and network addresses for SupplyChain and Migrations contracts
– public/: index.html and assets
• contracts/: Solidity source code for SupplyChain and Migrations
• migrations/: scripts to deploy smart contracts to the blockchain
• truffle-config.js: Truffle network configuration (RPC endpoints)
• test/: placeholder for Solidity/JS tests
• package.json / package-lock.json: dependencies (React, web3, Truffle, etc.)
README for additional insights
• Architecture section describes:
– Solidity smart contract compiled & deployed via Truffle on Gode Testnet
– Frontend uses Web3.js to talk to the smart contract
– MetaMask injects Web3 provider to the React app
a. Main components
1. React Frontend
• UI pages: Home, AssignRoles, AddMed, Supply, Track
• Web3.js integration module
2. Web3 Provider (injected by MetaMask)
3. Browser Wallet (MetaMask)
• Manages user accounts & signs transactions
4. JSON-RPC endpoint / Blockchain network
• Gode Testnet or local Ganache instance
5. Truffle Suite
• truffle-config.js, migrations scripts
6. Smart Contracts
• SupplyChain.sol, Migrations.sol
• Deployed contract address and ABI
7. Off-chain artifacts
• build artifacts (JSON ABI) consumed by frontend
b. Relationships & interactions
• User clicks UI → React component calls Web3.js → MetaMask popup to sign → JSON-RPC call to blockchain → Smart contract state updated → transaction receipt returned → React updates UI.
• Deployment flow: Truffle migrations → RPC endpoint → contract deployed → artifacts written to client/src/artifacts.
c. Architectural patterns & design principles
• Separation of concerns:
– Presentation (React UI)
– Application logic (Web3.js + ABI wrappers)
– Data & state persistence (blockchain smart contract)
• Role-based access control in smart contract (owner, raw material supplier, manufacturer, distributor, retailer)
• Single smart contract hosting multiple state machines (medicine tracking stages)
d. Technologies, frameworks, libraries
• React.js, Web3.js, MetaMask (frontend)
• Solidity, Truffle Suite (backend smart contract tooling)
• Ganache / Gode Testnet (blockchain node)
Final advice
• Be very detailed: capture each React component group, the Web3 adapter, wallet/provider, RPC node, and the smart contract with its roles.