How sudhirkumar6009/storagex works
Project Type & Purpose
• StorageX is a full-stack decentralized file-storage DApp.
• Frontend: React + TypeScript SPA (Vite/TailwindCSS) with Web3Auth/GoogleAuth.
• Backend: Node.js/Express handles encryption, IPFS via Filebase API, and MongoDB metadata.
• External services: IPFS (Filebase S3 gateway), MongoDB Atlas, Ethereum/Polygon via Infura, Web3Auth, Google OAuth.
File Structure
• Top-level split:
– /frontend: React components, contexts (Auth, Web3, Profile), UI libs, hooks, public assets, Vite config.
– /backend: Express server.js, modules for Filebase (IPFS), Mongo operations, Profile CRUD, Signin (Google OAuth), cryptoUtils.
• Config & deployment: vercel.json (frontend & backend), .env usage, package.json scripts.
• No microservices—single monolithic backend; SPA frontend.
Extract Architectural Insights from README
• DApp (client consults blockchain via Web3Auth/Infura + wallet).
• File uploads go through backend to IPFS/Filebase.
• Metadata (CID, profile data) stored in MongoDB Atlas.
• Authentication:
– Web3Auth (wallet login) on client.
– Optional Google OAuth → backend.
• Deployment: frontend on Vercel; backend on Render.
Main Components & Their Interactions
a. End User (Browser)
– UI (React + TS + Tailwind)
– Wallet connectors: Web3Auth, MetaMask, WalletConnect
– Google OAuth flow via backend
b. API Layer (Backend, Node.js/Express)
– Auth endpoints (Web3Auth token verification, Google OAuth)
– Filebase modules: uploadFile.js, deleteFile.js, listoutFiles.js
– Mongo modules: storePublicAddressMongo.js, cidMatchingMongo.js, mongoProfile.js
– Profile endpoints: fetchProfile.js, mongoProfile.js
– cryptoUtils.js for encrypt/decrypt
c. Data Stores & External Services
– IPFS via Filebase S3-compatible API
– MongoDB Atlas (metadata store)
– Ethereum/Polygon networks via Infura (for on-chain authentication if extended)
– Google OAuth (Web2)
d. Deployment & Infrastructure
– Frontend on Vercel (VITE_BACKEND_PORT_URL)
– Backend on Render (BACKEND_PORT_URL)
– Environment variables for credentials
Architectural Patterns & Design Principles
• SPA (Single-Page Application) decoupled from backend API
• “Thin” backend: orchestrates IPFS & Mongo calls, handles encryption
• Contexts in React provide global state (AuthContext, Web3Context, ProfileContext)
• Modular directory structure: separate Filebase, Mongo, Profile, Signin concerns
• Clear separation of concerns: UI, business logic, persistence, and external integrations
1) Client/UI Layer
2) API / Business Logic Layer
3) Data Layer
4) External Blockchains & Auth Providers
• Browser/React App
• Auth Module (Web3Auth & Google OAuth)
• Express API Server
• Filebase (IPFS Gateway)
• MongoDB Atlas
• Infura/Ethereum Network
– Browser → Express: HTTPS REST calls (Auth, Upload, Download, Profile)
– Browser ↔ Web3Auth/Infura: JSON-RPC calls for wallet operations
– Express → Filebase: HTTPS S3 API (upload/download)
– Express → MongoDB: MongoDB driver calls (insert, query)
– Express ↔ Google OAuth: OAuth2 redirects / token exchange
d. Data flows:
• File Upload: UI → Express → Filebase → CID → Express → MongoDB → UI
• File Fetch: UI → Express → MongoDB → Express → Filebase → UI
• Auth Flow: UI → Web3Auth/Infura (wallet sign) → Express → MongoDB (store address)
• Google Login: UI → Express (googleAccount.js) → OAuth endpoints → Express → UI
e. Technologies next to each component (e.g., “React + TS”, “Express + Node.js”, “MongoDB Atlas”, “Filebase IPFS API”, “Infura”).
Final Checklist
• All components labeled clearly.
• Technology stacks noted.