How vansh06saini/bloodtrack-smartbloodinventory-allocationandrequestmanagementsystem works
BloodTrack is a blood-bank and hospital coordination application. Hospital users register or log in, review inventory, submit and track blood requests, and schedule donations; administrators manage blood-unit stock and audit movement logs. The backend persists operational data in MySQL, runs priority-aware allocation and expiry cleanup workers, and exposes API routes to the frontend. The graph reflects documented routes and sampled calls; several frontend-to-API interactions are not visible in the supplied excerpts, so those links are dashed.
Main entry points: App.jsx Portal routing · hospitalController.js Hospital requests · server.js HTTP server and auth · bloodUnitController.js Stock and logs API
Components 22
Web portals
- Portal routing
frontend/src/App.jsx - Login and registration
frontend/src/components - Hospital dashboard
frontend/src/pages/hospital/HospitalDashboard.jsx - Create request
frontend/src/pages/hospital/CreateRequest.jsx - Request tracking
frontend/src/pages/hospital/MyRequests.jsx - Request details
frontend/src/pages/hospital/RequestDetails.jsx - Donation booking
frontend/src/pages/hospital/DonateBlood.jsx - Request service
frontend/src/pages/hospital/requestService.js - Admin dashboard
frontend/src/pages/admin/AdminDashboard.jsx - Add blood units
frontend/src/pages/admin/AddBloodUnits.jsx - Daily blood log
frontend/src/pages/admin/DailyBloodLog.jsx
Backend API
- HTTP server and auth
backend/server.js - Hospital requests
backend/controllers/hospitalController.js - Stock and logs API
backend/controllers/bloodUnitController.js - Donation appointments
backend/controllers/donationController.js - Allocation endpoint
backend/controllers/allocationController.js
Inventory operations
- Allocation worker
backend/workers/allocationWorker.js - Priority allocation
backend/services/allocationService.js - Expiry cleanup
backend/workers/expiryWorker.js
Persistence
- MySQL pool
backend/db.js
Other components
- Hospital user
- Blood-bank admin
Connections 34
- Hospital user → Portal routing: uses
- Blood-bank admin → Portal routing: uses
- Portal routing → Login and registration: routes to
frontend/src/App.jsx - Portal routing → Hospital dashboard: routes to
frontend/src/App.jsx - Portal routing → Create request: routes to
frontend/src/App.jsx - Portal routing → Request tracking: routes to
frontend/src/App.jsx - Portal routing → Request details: routes to
frontend/src/App.jsx - Portal routing → Donation booking: routes to
frontend/src/App.jsx - Portal routing → Admin dashboard: routes to
frontend/src/App.jsx - Portal routing → Add blood units: routes to
frontend/src/App.jsx - Portal routing → Daily blood log: routes to
frontend/src/App.jsx - Create request → Request service: uses
- Create request → Hospital requests: submits request
- Hospital dashboard → Hospital requests: loads summary
- Request tracking → Hospital requests: loads requests
- Request details → Hospital requests: loads details
- Donation booking → Donation appointments: books appointment
- Add blood units → Stock and logs API: adds units
- Admin dashboard → Stock and logs API: loads summary
- Daily blood log → Stock and logs API: loads logs
- HTTP server and auth → Hospital requests: routes requests
backend/server.js - HTTP server and auth → Stock and logs API: routes requests
backend/server.js - HTTP server and auth → Donation appointments: routes requests
backend/server.js - HTTP server and auth → Allocation endpoint: routes requests
backend/server.js - Hospital requests → MySQL pool: reads and writes
backend/controllers/hospitalController.js - Stock and logs API → MySQL pool: reads and writes
backend/controllers/bloodUnitController.js - Donation appointments → MySQL pool: reads and writes
backend/controllers/donationController.js - Allocation endpoint → Priority allocation: delegates
backend/controllers/allocationController.js - Hospital requests → Allocation worker: triggers emergency run
backend/controllers/hospitalController.js - HTTP server and auth → Allocation worker: starts worker
backend/server.js - HTTP server and auth → Expiry cleanup: starts worker
backend/server.js - Allocation worker → Priority allocation: processes requests
backend/workers/allocationWorker.js - Priority allocation → MySQL pool: allocates stock
backend/services/allocationService.js - Expiry cleanup → MySQL pool: expires units
backend/workers/expiryWorker.js