How md-ahmodullah/lifedrops works
Project Type and Purpose
• LifeDrops is a full-stack, MERN-style blood donation platform with a React single-page application (SPA) frontend, a Node/Express backend (not included in this repo but described in the README), MongoDB for data storage, Firebase for authentication and hosting, plus a Stripe (or similar) payment gateway for funding/donations.
• The React code is structured under src/, static JSON catalogs live in public/, and Firebase hosting configuration sits at the repo root.
File Structure Analysis
• Top-level files:
• firebase.json, .firebaserc → Firebase hosting & auth setup
• vite.config.js, postcss.config.js, tailwind.config.js → build/tooling
• index.html, public/… → entry point + static assets/data
• src/Components, src/Pages, src/Layout → UI components, page views, layout wrappers
• src/Hooks → custom data-fetching hooks (axios over public or secure API endpoints)
• src/Provider → React Context providers (Auth, Fund)
• src/Router → route definitions & guards (AdminRouter, PrivateRoute)
• src/PaymentGateWay → payment-related components (checkout form, funding flows)
• No backend code here—calls target externally hosted Express/Mongo API.
README Insights
• Core stack: React + TailwindCSS frontend, Node/Express API, MongoDB, Firebase Auth, Firebase Hosting.
• User roles: Admin, Donor, Volunteer
• Key features: authentication flows, role-based dashboards, CRUD on donation requests, blog CMS with Jodit, user management, status tracking, statistics dashboard, payment processing.
a. Main Components
• React SPA (Vite) deployed on Firebase Hosting
• Firebase Authentication service
• Node.js/Express REST API (hosted on e.g. Heroku, AWS, or GCP)
• MongoDB database (Atlas cluster)
• Stripe (or chosen payment gateway)
• Static JSON data store (served from Firebase Hosting)
• Third-party district/upazila JSON sources (public)
b. Relationships & Interactions
• User’s browser ↔ React SPA ↔ Firebase Auth (token flows)
• React SPA ↔ Express API (axiosPublic for open endpoints, axiosSecure for auth’d calls)
• Express API ↔ MongoDB (CRUD operations on users, requests, blogs, stats)
• React SPA ↔ Stripe (via CheckoutForm component)
• React SPA ↔ static JSON in public/ (to populate district/upazila dropdowns)
c. Architectural Patterns
• SPA with client-side routing (React Router)
• Context-driven state management (AuthProvider, FundProvider)
• Custom hooks for data fetching and caching
• Role-based route protection (PrivateRoute, AdminRouter)
• Separation of concerns: Components / Pages / Layout / Hooks / Providers / Router
d. Key Technologies
• React + React Router + Context API
• Axios for HTTP clients (useAxiosPublic, useAxiosSecure)
• TailwindCSS for styling, Jodit for rich-text editing
• Firebase Auth & Hosting
• Node.js + Express + MongoDB for backend
• Stripe (or equivalent) for payments