How syedshafinahmed/bloodlink-client works
1. Overall shape
- BloodLink is a React 19 single-page application built with Vite. It is a client-side UI for a blood donation platform rather than a full-stack repo.
- The app is organized around three major user surfaces: public marketing/browsing pages, a protected user dashboard, and admin management views.
2. App bootstrap and routing
- src/main.jsx is the entry point and mounts the app with global styles from src/index.css.
- src/routes/router.jsx defines the route map, and src/routes/PrivateRoute.jsx guards authenticated areas.
- Layout components split the UI shell by concern: RootLayout for the public site, AuthLayout for login/register screens, and DashboardLayout for authenticated dashboard pages.
3. Authentication boundary
- Auth state is centralized in src/context/AuthContext.jsx / AuthProvider.jsx and consumed through src/hooks/useAuth.jsx.
- Firebase is the authentication provider (src/firebase/firebase.init.js), so login/registration are client-side flows that establish the user session before protected routes and dashboard features become available.
4. Public site and content pages
- src/pages/home/* contains the homepage sections: banner, feature blocks, impact stats, how-it-works, testimonials, donor-related promos, etc.
- Other public pages include AboutUs, Services, donor search, and donation-request browsing/detail views.
- src/pages/shared/Navbar.jsx and Footer.jsx provide the global site chrome across public routes.
5. Donor discovery and location data
- Donor search is a core flow: the app lets users filter by blood group and location.
- Location data is shipped as static JSON in public/location.json, and there are also public/donors.json and public/serviceCenters.json for reference data shown or consumed by the UI.
- This means the donor-search experience is not purely dynamic; it has a built-in data layer for geographic filtering and directory-style browsing.
6. Donation-request workflow
- The donation-request subsystem lives in src/pages/HomeDonationRequests.jsx, src/pages/HomeDonationRequestsDetails.jsx, and the dashboard counterparts under src/dashboard/.
- Users can create, edit, inspect, and track requests; the README describes request states such as pending, in progress, done, and canceled.
- This is one of the main business flows and likely talks to the backend via API calls rather than local state only.
7. Dashboard subsystem
- src/dashboard/DashboardHome.jsx, Profile.jsx, DonationRequests.jsx, CreateDonationRequest.jsx, EditDonationRequest.jsx, and DonationRequestDetails.jsx form the authenticated user workspace.
- DashboardSkeleton.jsx suggests shared loading/placeholder handling for dashboard views.
- The dashboard is the main boundary where user-specific data, request management, and profile state are concentrated.
8. Admin subsystem
- src/dashboard/admin/AllUsers.jsx and AllDonationRequests.jsx are the administrative views.
- These pages indicate role-based authorization on top of authentication: normal users get their own dashboard, while admins can inspect or manage all users and all requests.
- The admin area is therefore a second security boundary beyond simple login.
9. Backend/API integration
- src/hooks/useAxiosSecure.jsx indicates a configured Axios client for authenticated backend calls.
- The README references VITE_API_URL, so the frontend is designed to consume a separate API service for operational data such as requests, user records, and possibly funding history.
- In architecture terms, the React app is a presentation layer that delegates business data operations to an external backend.
10. Funding and payments
- src/pages/FundingPage.jsx, FundingSuccess.jsx, and FundingCancel.jsx show a separate payment flow with success/cancel return states.
- The README says Stripe is used, so payment processing is an external checkout flow with callback/redirect handling in the SPA.
- This funding path is distinct from the donation-request flow: one is a support/payment mechanism for the platform, the other is blood-request management.
11. Cross-cutting UI concerns
- src/loading/Loading.jsx and src/components/ScrollToTop.jsx handle app-wide behavior rather than feature logic.
- src/toggle/Switch.jsx suggests a theme or mode toggle, while src/pages/shared/Navbar.jsx likely exposes the primary navigation and user actions.
- Styling is driven by TailwindCSS, with DaisyUI/MUI used for component-level UI patterns.
12. Hosting and deployment behavior
- public/_redirects indicates the app is deployed as a static SPA on a host that needs client-side route fallback support.
- vite.config.js and the Vite build pipeline shape the frontend deployment artifact.
- The app is therefore packaged as static assets, with runtime dependencies on Firebase, Stripe, and the external API backend.
13. Key architectural boundaries to draw
- Unauthenticated public experience: landing pages, search, service info, donor/request browsing.
- Authentication layer: Firebase-backed login/register and route protection.
- User dashboard: personal profile and donation-request lifecycle.
- Admin console: global moderation and oversight.
- External services: Firebase Auth, Stripe payments, and a backend API accessed through Axios.
Main entry points: DashboardLayout.jsx Dashboard layout · RootLayout.jsx Root layout · useAxiosSecure.jsx Secure API client · router.jsx Router
Components 28
Bootstrap & routing
App entry, routing, layouts, and global shell
- App entry · Mounts the React app and global styles
src/main.jsx - Router · Defines the application route map
src/routes/router.jsx - Private route · Protects authenticated and role-based areas
src/routes/PrivateRoute.jsx - Root layout · Shell for the public site
src/layouts/RootLayout.jsx - Auth layout · Shell for login and register screens
src/layouts/AuthLayout.jsx - Dashboard layout · Shell for authenticated dashboard pages
src/layouts/DashboardLayout.jsx
Public experience
Marketing pages, discovery pages, and shared site chrome
- Navbar · Primary navigation and user actions
src/pages/shared/Navbar.jsx - Footer · Global footer across public pages
src/pages/shared/Footer.jsx - Home · Homepage assembly of public sections
src/pages/home/Home.jsx - Search donors · Browse and filter donors by blood group and location
src/pages/SearchDonors.jsx - Request browse · Public donation-request listing
src/pages/HomeDonationRequests.jsx - Request details · Public donation-request details view
src/pages/HomeDonationRequestsDetails.jsx
Dashboard
Authenticated user workspace and admin views
- Dashboard home · Authenticated landing view
src/dashboard/DashboardHome.jsx - Profile · User profile management
src/dashboard/Profile.jsx - My requests · User donation-request list and tracking
src/dashboard/DonationRequests.jsx - Create request · Create a donation request
src/dashboard/CreateDonationRequest.jsx - Edit request · Edit an existing donation request
src/dashboard/EditDonationRequest.jsx - Request detail · Authenticated donation-request detail view
src/dashboard/DonationRequestDetails.jsx - All users · Admin oversight of users
src/dashboard/admin/AllUsers.jsx - All requests · Admin oversight of all donation requests
src/dashboard/admin/AllDonationRequests.jsx
Authentication
Auth state, route protection, and Firebase session setup
- Login · User sign-in screen
src/pages/auth/Login.jsx - Register · User sign-up screen
src/pages/auth/Register.jsx - Auth context · Centralized authentication state
src/context/AuthContext.jsx - Auth provider · Supplies auth state to the app
src/context/AuthProvider.jsx - useAuth · Consumer hook for auth state
src/hooks/useAuth.jsx
External services
Backend API, Firebase auth, and payment provider integration
- Firebase auth · Client-side Firebase authentication setup
src/firebase/firebase.init.js - Secure API client · Authenticated Axios client for backend calls
src/hooks/useAxiosSecure.jsx - Funding · Stripe-backed funding entry page
src/pages/FundingPage.jsx
Connections 33
- App entry → Router: boots · Application startup hands off to the route map
- App entry → Auth provider: wraps · Provides authentication state to the app
- Router → Root layout: public shell · Public routes render inside the main site layout
- Router → Auth layout: auth shell · Login and register routes use the auth layout
- Router → Dashboard layout: dashboard shell · Protected routes render inside the dashboard layout
- Router → Private route: protects · Authenticated areas are guarded by route checks
- Root layout → Navbar: contains · Public shell includes shared navigation
- Root layout → Footer: contains · Public shell includes shared footer
- Root layout → Home: shows · Root site surfaces the homepage
- Root layout → Search donors: shows · Public browsing includes donor search
- Root layout → Request browse: shows · Public browsing includes request listings
- Request browse → Request details: opens · Listing links to request detail pages
- Auth layout → Login: shows · Auth shell renders sign-in
- Auth layout → Register: shows · Auth shell renders sign-up
- Auth provider → Auth context: supplies · Provider publishes auth state
- Auth context → useAuth: consumed by · Components read auth through the hook
- Auth context → Firebase auth: backs · Auth state is established through Firebase
- Private route → useAuth: checks · Guard relies on current auth state
- Dashboard layout → Dashboard home: contains · Dashboard shell hosts the main overview
- Dashboard layout → Profile: contains · Dashboard shell hosts profile management
- Dashboard layout → My requests: contains · Dashboard shell hosts request tracking
- Dashboard layout → Create request: contains · Dashboard shell hosts request creation
- Dashboard layout → Edit request: contains · Dashboard shell hosts request editing
- Dashboard layout → Request detail: contains · Dashboard shell hosts request details
- Dashboard layout → All users: contains · Admin views are exposed in the authenticated workspace
- Dashboard layout → All requests: contains · Admin views are exposed in the authenticated workspace
- Dashboard home → Secure API client: loads data · Dashboard features fetch user-specific backend data
- My requests → Secure API client: loads data · Request management uses secured API calls
- Create request → Secure API client: writes · Creates requests through the backend API
- Edit request → Secure API client: writes · Updates requests through the backend API
- All users → Secure API client: loads data · Admin user management reads from the backend API
- All requests → Secure API client: loads data · Admin request oversight reads from the backend API
- Funding → Secure API client: starts checkout · Funding flow initiates payment-related backend interaction