How satyamgagre/blockchain-crowdfunding-dapp works
1. What this repo is
- VeriFund is a decentralized crowdfunding DApp built as a Next.js + React frontend backed by an Ethereum smart contract layer. The blockchain is the system of record for campaigns, donations, and refund logic; the app is primarily a client-side interface over that contract.
2. Primary architectural boundary
- The repository is split into two major halves:
- UI/application layer: pages/, Components/, Context/, lib/
- Blockchain layer: contracts/, scripts/, test/, hardhat.config.js
- There is no traditional server API in the repo; instead, the UI talks directly to Ethereum through wallet/provider integrations.
3. Frontend shell and routing
- pages/ defines the app routes and page-level composition:
- index.js for the main landing/home experience
- activity.jsx for transaction/campaign activity
- members.jsx for community or membership-related views
- whitepaper.jsx for documentation/content
- _app.js likely wires global providers and styling across all pages.
4. Reusable UI component layer
- Components/ contains the reusable visual building blocks:
- navigation and layout: NavBar, Menu, Footer, Logo
- marketing and hero content: Hero, BlurText
- crowdfunding-specific UI: CampaignList, CampaignCard, Card, PopUp
- These are presentation-only pieces that render campaign data and user actions supplied from higher layers.
5. Client-side state and blockchain context
- Context/CrowdFunding.js is the likely central state and interaction layer for the app.
- Context/CrowdFunding.json and Context/constants.js suggest this layer holds the contract ABI / configuration / addresses used by the frontend.
- This is the main bridge between UI components and on-chain operations: campaign fetches, donation submission, and account/wallet state.
6. Smart contract subsystem
- contracts/ contains the Solidity contract(s) that implement the crowdfunding rules.
- The README describes key contract responsibilities:
- campaign creation with owner validation
- donation handling
- fund tracking
- refund behavior when targets are not met
- This contract layer is the trust boundary and source of truth for financial state.
7. Wallet and chain interaction
- The project is designed around MetaMask / Ethereum wallet connection.
- User actions such as creating a campaign or donating flow from the UI into the wallet provider, then into the deployed contract.
- The blockchain response then drives the UI state shown on campaign cards, activity feeds, and modal dialogs.
8. Off-chain helper/data layer
- lib/campaignService.js appears to encapsulate campaign-related data access or transformation logic.
- lib/firebase.js indicates an off-chain Firebase integration used by the UI as a backend support service.
- In architecture terms, this is a secondary data layer alongside the chain, likely used for app support data rather than core fund custody.
9. Deployment, testing, and local development
- The blockchain workflow is managed by Hardhat:
- scripts/deploy.js deploys contracts
- test/Lock.js is a Hardhat test file
- hardhat.config.js configures compilation and networks
- This suggests a local development flow where the contract is deployed to a local node before the frontend connects to it.
10. Application flow: read path
- Campaign and activity data likely flow from:
- blockchain queries through the context/service layer
- into page components
- and finally into list/card/modal views
- The UI is therefore a projection of on-chain state, with any off-chain Firebase data acting as a supplement if needed.
11. Application flow: write path
- User-initiated actions such as “create campaign” or “donate” follow this path:
- page/component event
- context/action handler
- wallet transaction via Ethereum provider
- smart contract execution
- updated on-chain state
- UI refresh/re-render
- This is the core interaction loop of the DApp.
12. Styling and build tooling
- Styling is handled with Tailwind CSS plus global styles in styles/globals.css.
- next.config.mjs, postcss.config.js, tailwind.config.js, and jsconfig.json support the frontend build and developer experience.
- These are important for implementation, but they do not materially change the system architecture.
13. What to draw in an architecture diagram
- Show three main zones:
- Browser/UI: pages and reusable components
- State/service bridge: CrowdFunding context + campaign service + Firebase helper
- Blockchain: deployed Solidity contract accessed through MetaMask/Hardhat-managed deployment
- The important dependency direction is: UI → context/services → wallet/provider → smart contract → blockchain state → UI.
14. Overall architectural character
- This is a frontend-first decentralized application with a thin client-side orchestration layer and a blockchain-backed business core.
- The main trust boundary is the smart contract; the rest of the repository exists to present, connect, and manage that on-chain system.
Main entry points: CrowdFunding.js CrowdFunding · Components Components · pages Pages · contracts Contracts
Components 20
Browser UI
Next.js pages and reusable presentation components
- Pages · Route-level screens and page composition
crowdfunding/pages - App shell · Global providers and shared app wrapper
crowdfunding/pages/_app.js - Home · Primary crowdfunding landing experience
crowdfunding/pages/index.js - Activity · Campaign and transaction activity view
crowdfunding/pages/activity.jsx - Members · Membership or community-oriented view
crowdfunding/pages/members.jsx - Whitepaper · Documentation and explanatory content
crowdfunding/pages/whitepaper.jsx - Components · Reusable visual and interaction pieces
crowdfunding/Components - Nav & chrome · Navigation, menu, footer, and logo
crowdfunding/Components/NavBar.jsx - Hero · Landing-page hero and highlight text
crowdfunding/Components/Hero.jsx - Campaign views · Cards, lists, and popup interactions for campaigns
crowdfunding/Components/CampaignList.jsx
App Bridge
Client-side state, contract configuration, and off-chain helpers
- CrowdFunding · Main client-side state and blockchain interaction layer
crowdfunding/Context/CrowdFunding.js - Contract config · Contract ABI and deployment constants
crowdfunding/Context/CrowdFunding.json - Constants · Network and contract constants used by the frontend
crowdfunding/Context/constants.js - Campaign service · Campaign-oriented client logic and transformations
crowdfunding/lib/campaignService.js - Firebase · Secondary storage or support service for the app
crowdfunding/lib/firebase.js
Blockchain
Smart contract and Hardhat deployment workflow
- Contracts · Crowdfunding smart contract layer
crowdfunding/contracts - Deploy script · Contract deployment workflow
crowdfunding/scripts/deploy.js - Contract test · Smart contract behavior verification
crowdfunding/test/Lock.js - Hardhat config · Compilation and network configuration
crowdfunding/hardhat.config.js
Tooling
Build, styling, and developer configuration
- Styles · Global styling and utility CSS pipeline
crowdfunding/styles/globals.css
Connections 24
- Pages → App shell: wraps · App shell applies to all routes
- Pages → Home: contains · Route definition
- Pages → Activity: contains · Route definition
- Pages → Members: contains · Route definition
- Pages → Whitepaper: contains · Route definition
- App shell → CrowdFunding: provides · Global state and blockchain access
- Home → Components: renders · Composes shared UI
- Activity → Components: renders · Composes shared UI
- Members → Components: renders · Composes shared UI
- Whitepaper → Components: renders · Composes shared UI
- Components → Nav & chrome: includes · Navigation and layout chrome
- Components → Hero: includes · Marketing and intro sections
- Components → Campaign views: includes · Campaign lists, cards, and popups
- Campaign views → CrowdFunding: reads/writes · UI actions and campaign state flow through context
- CrowdFunding → Contract config: loads · Uses contract ABI and deployment metadata
- CrowdFunding → Constants: reads · Network and address configuration
- CrowdFunding → Campaign service: delegates · Campaign data access and transformation
- CrowdFunding → Firebase: supplements · Optional off-chain app data
- CrowdFunding → Contracts: calls · Queries and transactions target the on-chain contract
- Contracts → Deploy script: managed by · Deployment workflow
- Contracts → Contract test: verified by · Contract behavior tests
- Hardhat config → Deploy script: configures · Hardhat runtime for deployment
- Hardhat config → Contract test: configures · Hardhat runtime for testing
- Pages → Styles: uses · Global styling support