How taneja-garvit/newswave works
Main Components
• Frontend (dApp): Represented by the "truthwave-shared" directory, this component contains all the client-side code, React components (including specific components like BlockchainVisual, NewsFeed, and WalletConnect), styling (Tailwind), routing (via pages like Index, Article, and NotFound), and configuration for Vite.
• Backend: Located under the "news backend" directory, this Node.js/Express server is responsible for handling API requests, interfacing with Ethereum (via Web3.js), and serving as the intermediary between the frontend and external services.
• Decentralized Storage (IPFS): Used for storing news content (text, images, PDFs) in a tamper-proof way.
• Blockchain (Sepolia Testnet): Ensures that metadata (content hash, credibility scores, timestamps) is recorded on-chain for transparency.
• OpenAI API: Integrated to analyze news content and provide a credibility/trust metric.
• External Services/Utilities: This includes libraries dealing with Ethereum interactions and possibly other utilities (“ethereum.ts”, “ipfs.ts”, “openai.ts”, “utils.ts”) that reside in the “lib” folder.
Relationships and Interactions
• The Frontend (React client) enables users to upload news, view the public news feed, and display credibility scores.
• User-uploaded news goes from the Frontend to the Backend via an API call.
• The Backend handles the submission:
• It first stores the content on IPFS.
• Then, it updates the blockchain (Sepolia Testnet) with the content metadata.
• In parallel, it sends the news content to the OpenAI API to obtain a credibility/trust score.
• Once processed, the public news feed (accessible to the frontend) shows posts with data coming from a combination of blockchain records and IPFS storage.
• The Backend may also expose endpoints to fetch news data and status updates, which are consumed by the frontend.
Architectural Patterns and Design Principles
• Decoupled/Modular Architecture: The separation between the frontend and backend—with clear API boundaries—ensures that each component can evolve independently.
• Use of Decentralized Storage and Blockchain: The design leverages immutable data storage (IPFS) and transparent recording (blockchain) and combines these with centralized processing (backend API) to achieve security without compromising user anonymity.
• API Integration: The backend acts as a bridge integrating third-party services (OpenAI for credibility scoring).
Relevant Technologies and Frameworks
• Frontend: React.js, Vite, Tailwind CSS, and Web3.js.
• Backend: Node.js/Express (as indicated by the package-lock.json and directory structure).
• Blockchain: Ethereum Sepolia Testnet via Web3.js.
• Decentralized Storage: IPFS.
• External Service: OpenAI API.
• Additional: Use of TypeScript (as evidenced by .ts and .tsx files) and configuration files (e.g., bun.lockb, tailwind.config.ts, tsconfig.json).
Be Detailed Yet Clear
• Major components and interactions are included.
• As a software engineer, break the overall system into as many logical segments as possible so that each component’s function and interaction can be easily understood.