How vinaykumarng/majorprojectmain works
This is an agricultural supply-chain traceability dApp: participants register product batches, transfer custody through supply-chain stages, and inspect batch histories; administrators manage participants. The frontend connects wallets and presents these workflows against a Solidity contract. A MongoDB-backed API and blockchain synchronizer provide an additional indexing/query layer. The README is empty, so capabilities are inferred from the tree and sampled files; page-to-contract calls and API-client wiring are not shown and are left unasserted.
Main entry points: App.jsx Routed application · useContract.js Contract connection · server.js REST query API · syncBlockchain.js Blockchain synchronizer
Components 25
Web application
- Routed application
agri-supply-chain/frontend/src/App.jsx - Wallet session
agri-supply-chain/frontend/src/hooks/useWallet.js - Contract connection
agri-supply-chain/frontend/src/hooks/useContract.js - Dashboard
agri-supply-chain/frontend/src/pages/Dashboard.jsx - Batch registration
agri-supply-chain/frontend/src/pages/RegisterBatch.jsx - Custody transfer
agri-supply-chain/frontend/src/pages/TransferCustody.jsx - Product tracing
agri-supply-chain/frontend/src/pages/TraceProduct.jsx - Participant admin
agri-supply-chain/frontend/src/pages/AdminPanel.jsx - Demo loader
agri-supply-chain/frontend/src/pages/DemoLoader.jsx - History timeline
agri-supply-chain/frontend/src/components/Timeline.jsx - Transaction status
agri-supply-chain/frontend/src/components/TxStatus.jsx - Roles and formatting
agri-supply-chain/frontend/src/utils/formatters.js - Role definitions
agri-supply-chain/frontend/src/utils/roles.js
Blockchain ledger
- Supply-chain contract
agri-supply-chain/contracts/AgriculturalSupplyChain.sol
Query and indexing
- REST query API
agri-supply-chain/backend/server.js - Blockchain synchronizer
agri-supply-chain/backend/scripts/syncBlockchain.js - MongoDB
agri-supply-chain/backend/db/connection.js - Batch records
agri-supply-chain/backend/models/Batch.js - Transfer records
agri-supply-chain/backend/models/Transfer.js - Participant records
agri-supply-chain/backend/models/Participant.js - Event records
agri-supply-chain/backend/models/Event.js
Contract bindings
- Typed contract interface
agri-supply-chain/types/ethers-contracts/AgriculturalSupplyChain.ts - Contract factory
agri-supply-chain/types/ethers-contracts/factories/AgriculturalSupplyChain__factory.ts - Ethers shared types
agri-supply-chain/types/ethers-contracts/common.ts
Other components
- Supply-chain participants
Connections 36
- Supply-chain participants → Routed application: use workflows
agri-supply-chain/frontend/src/App.jsx - Routed application → Wallet session: creates session
agri-supply-chain/frontend/src/App.jsx - Routed application → Contract connection: creates connection
agri-supply-chain/frontend/src/App.jsx - Wallet session → Contract connection: provides signer
agri-supply-chain/frontend/src/App.jsx - Routed application → Dashboard: routes to
agri-supply-chain/frontend/src/App.jsx - Routed application → Batch registration: routes to
agri-supply-chain/frontend/src/App.jsx - Routed application → Custody transfer: routes to
agri-supply-chain/frontend/src/App.jsx - Routed application → Product tracing: routes to
agri-supply-chain/frontend/src/App.jsx - Routed application → Participant admin: routes to
agri-supply-chain/frontend/src/App.jsx - Routed application → Demo loader: routes to
agri-supply-chain/frontend/src/App.jsx - Batch registration → Transaction status: renders
agri-supply-chain/frontend/src/pages/RegisterBatch.jsx - Custody transfer → Transaction status: renders
agri-supply-chain/frontend/src/pages/TransferCustody.jsx - Participant admin → Transaction status: renders
agri-supply-chain/frontend/src/pages/AdminPanel.jsx - Product tracing → History timeline: renders
agri-supply-chain/frontend/src/pages/TraceProduct.jsx - Dashboard → Roles and formatting: uses
agri-supply-chain/frontend/src/pages/Dashboard.jsx - Product tracing → Roles and formatting: uses
agri-supply-chain/frontend/src/pages/TraceProduct.jsx - Roles and formatting → Role definitions: uses
agri-supply-chain/frontend/src/utils/formatters.js - Contract connection → Supply-chain contract: connects to
- Batch registration → Contract connection: submits batch
- Custody transfer → Contract connection: transfers custody
- Product tracing → Contract connection: reads history
- Participant admin → Contract connection: manages access
- Demo loader → Contract connection: loads demo data
- REST query API → MongoDB: connects
agri-supply-chain/backend/server.js - REST query API → Batch records: queries
agri-supply-chain/backend/server.js - REST query API → Transfer records: queries
agri-supply-chain/backend/server.js - REST query API → Participant records: queries
agri-supply-chain/backend/server.js - REST query API → Event records: queries
agri-supply-chain/backend/server.js - Blockchain synchronizer → Batch records: updates
agri-supply-chain/backend/scripts/syncBlockchain.js - Blockchain synchronizer → Transfer records: updates
agri-supply-chain/backend/scripts/syncBlockchain.js - Blockchain synchronizer → Participant records: updates
agri-supply-chain/backend/scripts/syncBlockchain.js - Blockchain synchronizer → Event records: updates
agri-supply-chain/backend/scripts/syncBlockchain.js - Blockchain synchronizer → Supply-chain contract: reads events
- Contract factory → Typed contract interface: types
agri-supply-chain/types/ethers-contracts/factories/AgriculturalSupplyChain__factory.ts - Typed contract interface → Ethers shared types: uses types
agri-supply-chain/types/ethers-contracts/AgriculturalSupplyChain.ts - Contract factory → Ethers shared types: uses types
agri-supply-chain/types/ethers-contracts/factories/AgriculturalSupplyChain__factory.ts