How harshau007/crowdfundx works
Main Components Identification
• Smart Contracts & Blockchain: Represent the contracts in the “contracts” directory. Include the Hardhat configuration (hardhat.config.ts), ignition modules (e.g., Lock.ts in ignition/modules), deployment scripts (scripts/deploy.ts and scripts/fastForwardTime.ts), and tests (in the test folder).
• Frontend Application: Represent the frontend folder which is structured as a Next.js application. Highlight directories such as:
• /src/app – This contains pages (e.g., campaign pages, contributions) plus API routes (e.g., API endpoint for “uploadToPinata”).
• /src/components – Modular UI components like CampaignCard, CampaignDetails, and other UI elements.
• /lib – Utility libraries for interacting with the smart contracts (e.g., contract.ts, utils.ts).
• External Services: Based on the API endpoint named “uploadToPinata” (found under frontend/src/app/api/uploadToPinata), note integration with external services such as Pinata for IPFS uploads or similar decentralized storage interactions.
• Build and Test Infrastructure: Capture the scripts used for deployment and time manipulation (scripts folder), the test configurations and scripts, and any build scripts dictated by the package.json at the root level or within the frontend.
Relationships and Interactions
• That the frontend interacts with the smart contracts via the utility functions (in frontend/src/lib/contract.ts) and possibly via blockchain APIs.
• API Layer in the Next.js app (under frontend/src/app/api) that handles operations like uploading to Pinata and may serve as wrappers for contract interactions.
• Flow of data from the UI components through the API routes to the blockchain and back (e.g., when creating or fetching campaign data).
• Testing and deployment paths: tests interact with the smart contracts directly, and deployment scripts (using Hardhat and Ignition modules) deploy the contracts to a local or test network.
Architectural Patterns and Technologies
• The project follows a layered architecture separating concerns between the smart contract backend and the Next.js frontend.
• It employs Infrastructure as Code principles via Hardhat, and testing is integral as seen with the test cases.
• Use of framework-specific configurations (e.g., tailwind.config, tsconfig.json, eslint configurations) emphasizes an organized approach to maintaining consistency in the frontend.
• Interaction with external IPFS/Pinata services suggests that the frontend might upload campaign images or metadata, linking blockchain data with decentralized storage.