How bikramkh07/raktadaan works
1. Repository shape
- This repo is primarily a React + Vite frontend for RaktaDaan Nepal, plus SQL schema files that define the backend data model.
- The README describes a separate Laravel API as the intended server-side boundary; that backend is not present in this tree, so the repo is best understood as a frontend client + database contract + backend API spec.
2. Top-level architecture
- index.html, src/main.jsx, and src/App.jsx form the app shell.
- App.jsx is the central composition point: it likely controls route/page selection, shared state, and UI-wide concerns such as language and notifications.
- src/index.css provides global styling for the whole app.
3. Page-level boundaries
- src/pages/ contains the major user-facing screens:
- HomePage for landing/marketing and primary CTAs
- FindDonorsPage for donor search and request discovery
- CreateRequestPage for submitting a blood request
- RegisterPage for donor/seeker onboarding
- DonorDashboard for donor availability/profile management
- SeekerDashboard for active requests and donor lists
- HeroesPage for the public “Blood Heroes” wall
- These pages are the main architectural units for diagramming user journeys.
4. Reusable UI components
- src/components/ holds shared presentation and interaction pieces:
- Navbar for global navigation and language toggle
- RequestCard for request status/fulfillment display
- HeroCard for donor hero profiles
- NotifPanel for slide-in notifications
- Toast for transient feedback
- WaBanner for WhatsApp-driven CTA/alerts
- These are cross-page UI boundaries rather than business-logic containers.
5. Data and mock-driven frontend state
- src/data/mockData.js and src/data/hospitalsData.js provide seed/reference data for the UI.
- The README explicitly says mock data is a stand-in for API calls, so the current frontend is likely API-ready but not yet API-wired.
- src/config.js probably centralizes runtime constants such as API base URL or feature toggles.
6. Internationalization is a first-class concern
- src/translations.js stores the UI text for English and Nepali.
- The language switch is surfaced in Navbar, and the README notes translation of province/district dropdowns and the use of the Mukta font.
- For architecture diagrams, treat language selection as a global UI state affecting most pages/components.
7. Map and location dependency
- src/components/MapView.jsx plus src/hooks/useGoogleMaps.js indicate a dedicated Google Maps integration layer.
- This is likely used to visualize hospitals, donor proximity, or request locations.
- Location is also central to matching logic described in the README, which uses GPS distance filtering on the backend.
8. Frontend-to-backend contract
- The README defines the API boundary around Laravel routes such as /api/auth/*, /api/donors, /api/requests, /api/heroes, and /api/notifications.
- The frontend is expected to consume these endpoints for auth, donor discovery, request creation, fulfillment updates, and notification retrieval.
- src contains the consumer-facing UI; the actual business rules are intended to live server-side.
9. Database subsystems
- The database/ folder contains three SQL modules:
- auth.sql for users, OTP, and Sanctum tokens
- blood_requests.sql for requests, fulfillments, and ratings
- notifications.sql for notification logs and WhatsApp queueing
- This split suggests three logical domains: identity/authentication, request lifecycle, and messaging/notifications.
10. External service integration
- The architecture depends materially on two external services:
- Laravel Sanctum for token-based API authentication
- Meta WhatsApp Business Cloud API for OTPs and blood-match/life-saved notifications
- Google Maps is the other major third-party dependency, used for location-aware donor matching and map display.
11. Core data flows
- Registration flow: RegisterPage collects user data, then the backend validates identity/OTP and stores a donor or seeker profile in auth-related tables.
- Donor matching flow: seekers create requests, the backend filters donors by blood group and proximity, and notifications/WhatsApp alerts are sent.
- Fulfillment flow: donors accept requests; seekers later mark blood as received; this updates request status and may trigger a thank-you notification.
- Visibility flow: fulfilled requests feed the public HeroesPage, which acts as a read-only achievements wall.
12. Behavioral boundaries worth drawing
- Public vs authenticated areas: landing, heroes, and discovery pages are public-facing; dashboards and request actions are authenticated.
- Client UI vs server rules: the frontend handles presentation and user interactions, while eligibility rules, throttling, OTP expiry, and availability checks are explicitly server-enforced.
- Notification rendering vs delivery: NotifPanel/Toast are UI surfaces; actual WhatsApp delivery is a backend integration.
13. What to show in an architecture diagram
- Place the React frontend as the presentation layer, with pages branching into shared components and data hooks.
- Show a separate Laravel API boundary for auth, donors, requests, heroes, and notifications.
- Under the backend, include the three SQL schema areas and the external integrations to MySQL, WhatsApp Cloud API, and Google Maps.
Main entry points: App.jsx App · MapView.jsx MapView · FindDonorsPage.jsx Find Donors · main.jsx main.jsx
Components 34
React frontend
Vite app shell, pages, shared components, and client-side state.
- index.html · HTML entry point for the Vite app.
index.html - main.jsx · Mounts the React application.
src/main.jsx - App · Central composition point for app-wide state and screen selection.
src/App.jsx - Global CSS · Application-wide styling.
src/index.css - Navbar · Global navigation and language toggle.
src/components/Navbar.jsx - NotifPanel · Slide-in notification surface.
src/components/NotifPanel.jsx - Toast · Transient feedback messages.
src/components/Toast.jsx - WaBanner · WhatsApp-focused call-to-action and alerts.
src/components/WaBanner.jsx - RequestCard · Request status and fulfillment card.
src/components/RequestCard.jsx - HeroCard · Public donor hero profile card.
src/components/HeroCard.jsx - MapView · Google Maps-backed location display.
src/components/MapView.jsx - useGoogleMaps · Loads and manages Google Maps integration.
src/hooks/useGoogleMaps.js - Translations · English and Nepali UI text resources.
src/translations.js - Config · Client runtime constants and API settings.
src/config.js - Mock Data · Frontend stand-in for API responses.
src/data/mockData.js - Hospitals Data · Hospital/location reference data for the UI.
src/data/hospitalsData.js - HomePage · Landing page and primary calls to action.
src/pages/HomePage.jsx - Find Donors · Donor search and request discovery screen.
src/pages/FindDonorsPage.jsx - Find Blood · Blood lookup and search-oriented screen.
src/pages/FindBloodPage.jsx - Create Request · Blood request submission flow.
src/pages/CreateRequestPage.jsx - Register · Donor and seeker onboarding.
src/pages/RegisterPage.jsx - Donor Dashboard · Donor availability and profile management.
src/pages/DonorDashboard.jsx - Seeker Dashboard · Active requests and donor list management.
src/pages/SeekerDashboard.jsx - Heroes Page · Read-only wall of fulfilled blood heroes.
src/pages/HeroesPage.jsx
Laravel API boundary
Backend contract described in README; not present in the repository tree.
- Auth API · Authentication, OTP, and token issuance boundary.
- Donors API · Donor profiles, availability, and matching endpoints.
- Requests API · Blood request lifecycle and fulfillment endpoints.
- Heroes API · Public achievement/feed endpoints for fulfilled requests.
- Notifications API · Notification retrieval and delivery coordination.
Database schemas
SQL modules defining the backend data model.
- auth.sql · Users, OTP, and Sanctum token tables.
database/auth.sql - blood_requests.sql · Requests, fulfillments, and ratings tables.
database/blood_requests.sql - notifications.sql · Notification logs and WhatsApp queue tables.
database/notifications.sql
External services
Third-party services used by the system.
- MySQL · Primary relational store implied by the SQL schemas.
- WhatsApp Cloud API · Used for OTP and blood-match notifications.
Connections 37
- index.html → main.jsx: loads · HTML entry bootstraps the React runtime.
- main.jsx → App: mounts · Application root renders the main composition shell.
- App → Global CSS: styles · Global styles affect the whole app.
- App → Navbar: shares · Top-level navigation is used across screens.
- App → NotifPanel: shares · Global notification surface.
- App → Toast: shares · Transient feedback used by multiple flows.
- App → WaBanner: shares · WhatsApp CTA/banner is app-wide.
- App → Translations: uses · Language state feeds translated UI text.
- App → Config: uses · Reads runtime configuration such as API base settings.
- App → HomePage: routes to · Landing experience.
- App → Find Donors: routes to · Donor discovery flow.
- App → Find Blood: routes to · Blood search flow.
- App → Create Request: routes to · Request submission flow.
- App → Register: routes to · Onboarding flow.
- App → Donor Dashboard: routes to · Authenticated donor area.
- App → Seeker Dashboard: routes to · Authenticated seeker area.
- App → Heroes Page: routes to · Public hero wall.
- HomePage → Mock Data: reads · Landing content and samples use seed data.
- Find Donors → RequestCard: renders · Shows request and donor discovery cards.
- Find Donors → MapView: maps · Displays nearby donors or hospitals on a map.
- Create Request → Hospitals Data: uses · Hospital options and location references.
- Register → Auth API: submits to · Registration and OTP verification flow.
- Donor Dashboard → Donors API: updates · Availability and profile management.
- Seeker Dashboard → Requests API: manages · Creates and tracks requests.
- Heroes Page → Heroes API: reads · Loads fulfilled requests for the public wall.
- App → Notifications API: consumes · Notification retrieval and alert state.
- Auth API → auth.sql: persists · Auth records and tokens are stored in schema tables.
- Requests API → blood_requests.sql: persists · Request lifecycle data is stored here.
- Notifications API → notifications.sql: persists · Notification events and queues are stored here.
- auth.sql → MySQL: runs on · Schemas are implemented in MySQL.
- blood_requests.sql → MySQL: runs on · Schemas are implemented in MySQL.
- notifications.sql → MySQL: runs on · Schemas are implemented in MySQL.
- Auth API → WhatsApp Cloud API: sends OTPs · OTP delivery is delegated to WhatsApp.
- Notifications API → WhatsApp Cloud API: delivers alerts · Match and thank-you notifications use WhatsApp.
- useGoogleMaps → MapView: powers · Hook manages map loading and usage.
- MapView → Donors API: supports · Map visualization complements location-aware donor discovery.
- MapView → Hospitals Data: renders · Reference locations can be shown on the map.