How valesh-gosats/donation-portal-dapp works
Main Components
• Frontend (Next.js App):
• This includes the UI for various pages (home, create donation, dashboard, opportunities list/detail) and reusable React components (e.g., Header, Navbar, ConnectButton).
• Custom hooks (e.g., useDonationOpportunities, useEthPrice, useOpportunityFactory) indicate direct Web3 interactions.
• Providers, such as the Web3 provider, manage blockchain connectivity.
• Blockchain Layer:
• Smart contracts in the "contracts" folder define the logic for donation opportunities.
• ABIs in app/lib/contracts describe the contract interfaces and are used for Ethers.js integrations.
• Scripts (scripts/deploy.ts) indicate deployment routines for the blockchain contracts.
• Storage & Decentralized Proof Storage:
• IPFS utilities in app/lib/ipfs demonstrate integration with decentralized file storage.
• This is critical for storing verification data or proofs in a transparent and tamper-proof way.
• Backend & Database (though minimal code is present in the repository, the README mentions it):
• Supabase and Prisma ORM serve as the backend for authentication, recipients’ profiles, and transactional data.
• Even if not directly visible in the file tree, these services should be represented.
• Additional Utilities:
• Helper files like conversion utilities (usdToEth.ts) and country libraries (countries.ts)
• Configuration files (.env.example, next.config.js, hardhat.config.cjs) denote environment settings, contract deployments, and general project configuration.
Architectural Patterns and Design Principles
• Modular Design: Clear separation with directories for components, hooks, libraries, and pages indicates a modular, maintainable architecture.
• Decoupling Between Frontend and Blockchain: The use of custom hooks and lib files (e.g., wagmi.ts) encapsulates Web3 interactions separately from UI concerns.
• API Routes: If API endpoints exist under "app/api", show them as intermediary layers between the frontend and backend.
• Use of Providers: Illustrate provider components (e.g., Web3Provider) to manage global state and external integrations.
Relevant Technologies, Frameworks, and Libraries
• Frontend: Next.js, React, TailwindCSS.
• Blockchain: Ethereum, Ethers.js (via provided contract ABIs), and Hardhat for contracts.
• Storage: IPFS (web3.storage).
• Authentication/Backend: Supabase, Prisma ORM.
• Additional libraries: Custom hooks for Ethereum price retrieval and factory interactions.