How atharmohammad/solana-file-sharing-system works
Project Type and Purpose
• This is a full-stack decentralized application (dApp) that enables anonymous, verifiable file sharing by combining:
• A React-based web frontend (“app” directory)
• An IPFS client frontend (“ipfs” directory)
• A Solana on-chain program written with Anchor (“programs/solana_file_sharing_system”)
• Deployment scripts/migrations (in “migrations”)
• End-to-end tests (“tests”)
High-Level Architecture Components
• Frontend (React)
• UI for file upload, wallet connection, file listing
• Uses Solana wallet adapter and Anchor-generated IDL
• Communicates with IPFS and Solana RPC
• IPFS Client (React)
• Standalone interface demonstrating plain IPFS integration
• Solana Program (On-chain)
• Rust/Anchor smart contract for tracking file metadata (hash, owner, timestamp) on Solana ledger
• IPFS Network (External Service)
• Distributed file storage; returns content-addressed CIDs for uploaded files
• Solana RPC Node (External Service)
• Provides JSON RPC API for reading/writing program accounts on Solana devnet/mainnet
• Migrations & Testing
• “migrations/deploy.js” orchestrates Anchor deploy
• “tests/solana_file_sharing_system.js” runs automated integration tests
Relationships & Data Flows
• User loads Web App → connects wallet via Solana wallet adapter
• On Upload:
1. Frontend sends file bytes to IPFS node → receives content CID
2. Frontend calls Solana program method (e.g., “add_file”) passing CID & metadata → transaction sent to Solana RPC
3. Solana program stores metadata in on-chain account
• On List/Read:
1. Frontend queries Solana accounts for stored file list
2. Retrieves each CID → fetches file from IPFS public gateway
• Tests: simulate above flows using Anchor & local test validator
Architectural Patterns & Design Principles
• Separation of concerns: UI, storage layer (IPFS), ledger layer (Solana program)
• Content addressing for immutability (IPFS)
• Transactional consistency and cryptographic verification (Solana)
• Modular code generation: Anchor IDL generates client bindings in React
Technologies & Frameworks
• React, TypeScript (app/)
• JavaScript (ipfs/)
• Anchor framework, Rust (programs/)
• IPFS client library (js-ipfs or related)
• Solana CLI & Anchor CLI for builds/deployments
• Netlify (or static host) for app deployment
• UI (blue), External services (green), On-chain components (orange), Dev tooling (gray)