How osamashaikh90/file-storage-system works
Project Type and Purpose
• The project is a decentralized web application (dApp) built for secure file storage on the blockchain.
• Users can upload files, view them directly when connected with a wallet, and manage file sharing through an allowlist mechanism.
• The tech stack combines a React-based frontend with smart contract logic (written in Solidity and managed by Hardhat) and blockchain integrations via Web3.js.
Analysis of the File Structure
• The top-level structure includes configuration files (e.g., .gitignore, LICENSE, README.md) and a client folder containing both frontend and blockchain components.
• The client directory further divides into:
– Contracts: Contains smart contract sources (under client/contracts) and a Hardhat configuration file (client/hardhat.config.js). This indicates where blockchain logic resides.
– Scripts: Includes deployment scripts (e.g., client/scripts/deploy.js) used for deploying and interacting with the smart contracts.
– Public: Static assets like HTML, CSS, images, and videos for the user interface.
– Src: Contains the React application’s code (App.js, various components, CSS files) that drive the frontend view and interactions.
• Presence of both package.json and package-lock.json in both top-level and client folders shows dependency management and that the project is configured as a Node.js-based front-end/back-end system.
Insights from the README
• The README clearly outlines the system’s features (file upload, file sharing with allowlist, privacy features) and provides a high-level overview of how users interact with the system.
• The technical stack notes the use of ReactJS for the front end, Solidity/Hardhat for the backend, Web3.js for blockchain integration, and Pinata for storage.
• The README includes instructions for setup, usage, and wallet connectivity – all of which are driven by the interplay between the frontend and blockchain backend.
a. Main Components:
• Frontend Interface: Represents the React app (client/src and client/public), including components such as file upload, wallet connection, and UI for viewing files.
• Smart Contracts: The Solidity contracts in client/contracts that handle file storage logic, manage the allowlist, and facilitate file sharing.
• Blockchain Network: The actual blockchain (local Hardhat network during development, migrating to Mumbai Testnet for deployment) where the smart contracts are deployed.
• Deployment & Scripting: Hardhat configuration and deployment scripts (client/hardhat.config.js, client/scripts/deploy.js) which are responsible for contract deployment and interactions.
• External Storage/API: Even though not directly shown in the file tree, the README mentions Pinata. This is depicted as an external service that handles actual file storage off-chain, with references via the blockchain.
b. Relationships and Interactions:
• Users interact with the Frontend, which in turn utilizes Web3.js to communicate with deployed smart contracts on the Blockchain Network.
• The Smart Contracts govern aspects like file metadata, access permissions (allowlist/disallowed addresses), and file-sharing logic.
• Deployment Scripts interact with Hardhat to deploy smart contracts and update the client configuration accordingly.
• The External Storage system (Pinata) works alongside the blockchain—for instance, file contents might be stored off-chain on Pinata with a reference (IPFS hash) maintained in the blockchain.
c. Architectural Patterns/Design Principles:
• Decoupled Frontend and Blockchain Backend: The interface is separated from the smart contract logic.
• Client-Side Web3 Integration: The design uses wallet connectivity and web3 libraries to interact with the blockchain.
• Secure File Management: Emphasis is placed on relational permissions (allowlist) and privacy features.
• Use of Smart Contracts as the Core Business Logic: The contracts serve as the immutable ledger for file metadata and access control.
d. Relevant Technologies, Frameworks, and Framework Roles:
• Frontend: ReactJS for UI, with supporting libraries for styles and media.
• Blockchain: Solidity-based smart contracts managed and deployed via Hardhat.
• Integration: Web3.js library used for blockchain interactions in the frontend.
• API Interaction: Axios may be present for interfacing with Pinata or other external systems.
• External File Storage: Pinata for file persistence using IPFS (as noted in the README).