How aadyatalreja/shipment-service works
1. This repository is a two-part DApp: a Solidity smart-contract backend and a React frontend. The core business state lives on Ethereum, while the browser app is only a client that reads chain data and submits transactions.
2. The on-chain subsystem is under solidity/. It contains the shipment-order contract implementation, Hardhat configuration, a deployment module, and test scaffolding. This is the authoritative layer for order lifecycle logic such as creation, shipping, acceptance, cancellation, and stage-based queries.
3. Deployment is handled through Hardhat Ignition in solidity/ignition/modules/ShipmentService.js. The presence of deployment artifacts under solidity/ignition/deployments/chain-11155111/ shows the contract has been deployed to Sepolia, and the repo retains the resulting addresses and build metadata.
4. The Solidity project also includes compiled/generated outputs in artifacts/, cache/, and dist/. These are build-time boundaries rather than application logic, and they support local compilation, testing, and redeployment.
5. The frontend subsystem lives in frontend/ and is a standard React app. frontend/src/App.js is the main UI entry point, with public/ providing the static shell and src/index.js bootstrapping the application into the browser.
6. Frontend-to-chain integration is the key data flow boundary. The README indicates App.js contains the deployed contract address, and frontend/src/utils/ShipmentService.json holds the contract artifact/ABI copied from the Solidity build. That file is what lets the React app encode contract calls and decode returned data.
7. The runtime interaction pattern is: user action in the React UI -> web3 call from the browser -> transaction or read against the Ethereum network -> contract state change or query -> updated shipment/order information returned to the UI. Because the logic is on-chain, persistence, authorization, and state transitions are not duplicated in the frontend.
8. Contract ownership is an important architectural boundary. The README says the contract owner can mark shipments as shipped and inspect packages by stage, while customers can create orders, accept deliveries with OTPs, and cancel only while processing. That implies role-sensitive access control is enforced in Solidity, not in UI code.
9. The repository is designed around Sepolia as the primary external network. Environment variables in solidity/.env and the Hardhat instructions show deployment depends on an RPC provider key and a private key, so the blockchain network is an external infrastructure dependency.
10. Testing is split by layer. solidity/test/ covers smart-contract behavior with Hardhat tests, while frontend/src/App.test.js and setupTests.js provide basic React-side testing. This separation matches the architecture: contract correctness is validated independently of the browser client.
11. documentation/ contains presentation and report assets rather than runtime components. Those files are useful for understanding intended system behavior, but they do not participate in execution.
12. In diagram terms, the main boundaries are: browser UI, contract integration layer, Ethereum/Sepolia network, and the deployment/tooling layer. The only persistent source of truth is the smart contract state on-chain; the React app and generated JSON artifacts are supporting clients and build-time bridges.
Main entry points: contracts Shipment contract · App.js App UI · ShipmentService.json Contract ABI · ShipmentService.js Ignition module
Components 16
Frontend
React browser client and UI-side integration
- App UI · Main browser interface and user actions
frontend/src/App.js - Bootstrap · Mounts the app into the browser
frontend/src/index.js - Contract ABI · Frontend copy of contract artifact used for calls
frontend/src/utils/ShipmentService.json - Public shell · HTML and static browser shell
frontend/public/index.html - UI tests · Browser-side component and setup tests
frontend/src/App.test.js
Solidity
On-chain contract, deployment, and build tooling
- Shipment contract · Authoritative shipment and order lifecycle logic
solidity/contracts - Hardhat config · Project config for compile, test, and deploy workflows
solidity/hardhat.config.js - Ignition module · Deploys the shipment service contract
solidity/ignition/modules/ShipmentService.js - Sepolia deploy · Recorded deployed addresses and build metadata
solidity/ignition/deployments/chain-11155111 - Build artifacts · Compiled contract metadata for local tooling
solidity/artifacts - Compiler cache · Solidity compilation cache and file tracking
solidity/cache - Bundle · Generated Solidity-side bundle output
solidity/dist/bundle.js - Contract tests · Smart-contract behavior and lifecycle validation
solidity/test/Lock.js - Env config · RPC and private-key settings for deployment
solidity/.env
Network
External Ethereum/Sepolia dependency
- Sepolia · External chain where contract state and transactions live
Docs
Presentation and report assets
- Reports · Non-runtime documentation and presentation materials
documentation
Connections 17
- Bootstrap → App UI: loads · Bootstraps the main React UI
- Public shell → Bootstrap: hosts · Provides the static browser shell
- App UI → Contract ABI: uses · Reads contract ABI and deployment details for web3 calls
- App UI → Sepolia: reads/writes · Submits transactions and queries on-chain state
- Contract ABI → Shipment contract: encodes · Matches the deployed contract interface
- Shipment contract → Sepolia: stores state · Shipment and order state live on chain
- Hardhat config → Shipment contract: compiles · Defines the Solidity build and project configuration
- Ignition module → Shipment contract: deploys · Deploys the shipment service implementation
- Ignition module → Env config: uses · Depends on deployment credentials and RPC settings
- Env config → Sepolia: targets · Configures deployment against the Sepolia network
- Sepolia deploy → Sepolia: records · Persists deployed contract addresses for Sepolia
- Build artifacts → Contract ABI: feeds · Provides generated ABI and build metadata to the frontend copy
- Compiler cache → Build artifacts: supports · Compilation cache supports generated outputs
- Bundle → Shipment contract: builds from · Generated bundle is derived from contract sources
- Contract tests → Shipment contract: verifies · Checks lifecycle behavior and access rules
- UI tests → App UI: verifies · Checks browser-side rendering and interactions
- Reports → Shipment contract: describes · Documents the intended shipment service behavior