E5CA GitHub - ThanuMahee12/AH-WELLNESS-HUB: Blood & Lab Manager - A comprehensive POS system for medical laboratories that streamlines blood sample collection, patient registration, test management, billing, and automated report generation. Simplifies daily lab operations efficiently.
[go: up one dir, main page]

Skip to content

Blood & Lab Manager - A comprehensive POS system for medical laboratories that streamlines blood sample collection, patient registration, test management, billing, and automated report generation. Simplifies daily lab operations efficiently.

Notifications You must be signed in to change notification settings

ThanuMahee12/AH-WELLNESS-HUB

Repository files navigation

Blood Lab Manager πŸ§ͺ

A complete Point of Sale (POS) system for blood testing laboratories with Firebase backend and automatic deployment. Features patient management, blood test catalog, billing/checkups, user management, and professional PDF invoice generation.

React Firebase Redux Bootstrap

✨ Features

Core Functionality

  • πŸ” User Authentication - Firebase email/password authentication
  • πŸ‘₯ Patient Management - Complete CRUD operations
  • 🧬 Blood Tests Catalog - Manage test types, prices, and rules
  • πŸ“‹ Checkup/Billing - Create bills with multiple tests
  • πŸ“„ PDF Generation - Professional invoice generation
  • πŸ‘€ User Management - Create and manage staff users
  • πŸ“Š Dashboard - Analytics and statistics
  • 🎨 Responsive Design - Works on all devices

Technical Features

  • ☁️ Cloud Database - Firestore for real-time data
  • πŸš€ Auto-Deployment - GitHub Actions to Firebase Hosting
  • πŸ“¦ Redux Thunk - Async state management
  • πŸ”„ Real-time Updates - Live data synchronization
  • πŸ›‘οΈ Secure - Firebase Authentication & Firestore Rules
  • πŸ“± Mobile-First - Bootstrap responsive design

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Firebase account (free tier works)
  • Git

Installation

  1. Clone the repository
git clone <your-repo-url>
cd Blood-Lab-Manager
  1. Install dependencies
npm install
  1. Set up Firebase (Detailed guide: FIREBASE_SETUP.md)

    • Create Firebase project
    • Enable Authentication (Email/Password)
    • Enable Firestore Database
    • Get configuration values
  2. Configure environment

# Copy the example file
cp .env.example .env

# Edit .env with your Firebase config
VITE_FIREBASE_API_KEY=your-api-key
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
VITE_FIREBASE_APP_ID=your-app-id
VITE_FIREBASE_MEASUREMENT_ID=your-measurement-id
  1. Create initial admin user

  2. Run development server

npm run dev
  1. Open in browser
http://localhost:5173

πŸ“š Documentation

All documentation is in the docs folder:

Document Description
Firebase Setup Complete Firebase setup guide
Deployment Guide Deployment overview and guide
GitHub Actions Setup CI/CD auto-deployment setup
GitHub Secrets Setup ⚠️ Required: Set up GitHub Secrets
First User Setup Create your initial admin user
Version Guide Version management and releases
Implementation Summary Technical implementation details
Remaining Updates Pending updates and improvements
Claude.md Project structure and conventions

πŸ—οΈ Project Structure

Blood-Lab-Manager/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ common/              # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ Navbar.jsx           # Top navigation
β”‚   β”‚   β”œβ”€β”€ Sidebar.jsx          # Side navigation
β”‚   β”‚   β”œβ”€β”€ Footer.jsx           # Footer component
β”‚   β”‚   └── ProtectedRoute.jsx  # Route authentication
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── firebase.js          # Firebase initialization
β”‚   β”œβ”€β”€ pages/                   # Page components
β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚   β”‚   β”œβ”€β”€ Login.jsx
β”‚   β”‚   β”œβ”€β”€ Dashboard.jsx
β”‚   β”‚   β”œβ”€β”€ Patients.jsx
β”‚   β”‚   β”œβ”€β”€ Tests.jsx
β”‚   β”‚   β”œβ”€β”€ Checkups.jsx
β”‚   β”‚   └── Users.jsx
β”‚   β”œβ”€β”€ services/                # Business logic
β”‚   β”‚   β”œβ”€β”€ authService.js       # Authentication operations
β”‚   β”‚   └── firestoreService.js  # Database operations
β”‚   β”œβ”€β”€ store/                   # Redux state
β”‚   β”‚   β”œβ”€β”€ store.js
β”‚   β”‚   β”œβ”€β”€ authSlice.js
β”‚   β”‚   β”œβ”€β”€ patientsSlice.js
β”‚   β”‚   β”œβ”€β”€ testsSlice.js
β”‚   β”‚   β”œβ”€β”€ checkupsSlice.js
β”‚   β”‚   └── usersSlice.js
β”‚   β”œβ”€β”€ styles/                  # CSS files
β”‚   β”‚   β”œβ”€β”€ sidebar.css
β”‚   β”‚   β”œβ”€β”€ navbar.css
β”‚   β”‚   └── footer.css
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── pdfGenerator.js      # PDF invoice generation
β”‚   β”œβ”€β”€ App.jsx                  # Main app component
β”‚   └── main.jsx                 # Entry point
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── firebase-deploy.yml  # Auto-deployment workflow
β”œβ”€β”€ firebase.json                # Firebase hosting config
β”œβ”€β”€ .firebaserc                  # Firebase project config
└── .env.example                 # Environment template

πŸ› οΈ Tech Stack

Category Technology
Frontend React 19.1.1
Build Tool Vite 7.1.7
State Management Redux Toolkit 2.9.0
Routing React Router DOM 7.9.4
UI Framework React Bootstrap 2.10.10 + Bootstrap 5.3.8
Icons React Icons 5.5.0
PDF jsPDF 3.0.3 + jspdf-autotable 5.0.2
Backend Firebase 12.4.0 (Auth + Firestore)
Hosting Firebase Hosting
CI/CD GitHub Actions

πŸ”‘ Key Technologies Explained

Firebase

  • Authentication: Secure user login with email/password
  • Firestore: NoSQL cloud database for all app data
  • Hosting: Fast, secure web hosting with global CDN

Redux Toolkit

  • Slices: Modular state management
  • Thunks: Async operations (API calls)
  • Immer: Immutable state updates made easy

React Bootstrap

  • Components: Pre-built UI components
  • Responsive: Mobile-first grid system
  • Theming: Consistent design system

πŸ“± Screenshots

Login

Secure authentication with Firebase

Dashboard

Analytics and key metrics at a glance

Patients

Complete patient management system

Checkups/Billing

Create bills, generate PDF invoices

πŸš€ Deployment

Manual Deployment

# Build the app
npm run build

# Deploy to Firebase
firebase deploy --only hosting

Automatic Deployment (GitHub Actions)

  1. ⚠️ IMPORTANT: Set up GitHub Secrets first (see docs/GITHUB_SECRETS_SETUP.md)
  2. Push to main branch
  3. Automatically builds and deploys!
git add .
git commit -m "feat: add new feature"
git push origin main
# πŸš€ Deploys automatically!

🎯 Available Scripts

Command Description
npm run dev Start development server (http://localhost:5173)
npm run build Build for production (outputs to dist/)
npm run preview Preview production build locally
npm run lint Run ESLint for code quality

πŸ”’ Security

Firebase Config

  • API keys in .env are safe to expose publicly
  • Th DE7E ey identify your Firebase project only
  • Security comes from Firestore Rules and Authentication

Firestore Security Rules

Update in Firebase Console for production:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    // Only authenticated users can access data
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

Best Practices

  • βœ… .env is in .gitignore (never commit it)
  • βœ… Use GitHub Secrets for CI/CD
  • βœ… Rotate Firebase service accounts periodically
  • βœ… Enable Firebase App Check for production
  • βœ… Monitor usage in Firebase Console

πŸ“Š Data Models

User

{
  uid: "firebase-auth-uid",
  username: "John Doe",
  email: "john@example.com",
  mobile: "1234567890",
  role: "user",
  createdAt: "2025-01-11T..."
}

Patient

{
  id: "auto-id",
  name: "Patient Name",
  age: 30,
  gender: "Male",
  mobile: "1234567890",
  address: "123 Main St",
  email: "patient@example.com"
}

Blood Test

{
  id: "auto-id",
  name: "Complete Blood Count",
  price: 500,
  details: "Measures blood components",
  rules: "Fasting not required"
}

Checkup/Bill

{
  id: "auto-id",
  patientId: "patient-id",
  tests: [
    { id: "test1", name: "CBC", price: 500 }
  ],
  total: 500,
  notes: "Follow-up required",
  timestamp: "2025-01-11T10:30:00Z"
}

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ› Troubleshooting

Common Issues

"Firebase not initialized"

  • Verify .env file exists with all variables
  • Ensure variables start with VITE_
  • Restart dev server

"Permission denied" in Firestore

  • Update Firestore Security Rules
  • Ensure user is authenticated

"User not found" after login

  • Create user profile in Firestore
  • Document ID must match Auth UID

See docs/FIREBASE_SETUP.md for more troubleshooting help.

⚠️ Authentication Issue: Dashboard Opens Directly

Problem: Live app bypasses login page and opens dashboard directly Cause: GitHub Secrets not configured

Solution:

  1. Go to: https://github.com/ThanuMahee12/Blood-Lab-Manager/settings/secrets/actions
  2. Add all 7 Firebase secrets (see docs/GITHUB_SECRETS_SETUP.md)
  3. Re-run failed GitHub Actions workflow
  4. Wait 2-3 minutes for redeployment

Quick Fix: Add these secrets to GitHub:

  • VITE_FIREBASE_API_KEY
  • VITE_FIREBASE_AUTH_DOMAIN
  • VITE_FIREBASE_PROJECT_ID
  • VITE_FIREBASE_STORAGE_BUCKET
  • VITE_FIREBASE_MESSAGING_SENDER_ID
  • VITE_FIREBASE_APP_ID
  • VITE_FIREBASE_MEASUREMENT_ID

πŸ“ž Support

πŸŽ‰ Acknowledgments

  • React Team for the amazing framework
  • Firebase for backend infrastructure
  • Bootstrap team for the UI framework
  • Redux Toolkit for state management

πŸ“ˆ Roadmap

  • Add more blood test types
  • Implement appointment scheduling
  • Add inventory management
  • Email invoice delivery
  • SMS notifications
  • Advanced analytics
  • Multi-language support
  • Dark mode theme

🌟 Star History

If you find this project useful, please consider giving it a star! ⭐


πŸ“š Documentation

Comprehensive guides and documentation are available in the docs/ folder:

Setup & Configuration

Features & Implementation

Development

  • CLAUDE.md - Development guidelines and project structure for AI assistants

Built with ❀️ using React, Firebase, and modern web technologies

About

Blood & Lab Manager - A comprehensive POS system for medical laboratories that streamlines blood sample collection, patient registration, test management, billing, and automated report generation. Simplifies daily lab operations efficiently.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
0