Skip to content

Full-stack pathology laboratory management system built with Spring Boot and React. Features patient management, test booking, sample tracking, result generation with PDF reports, and admin dashboards. JWT authentication, PostgreSQL database, and modern UI with Tailwind CSS.

License

Notifications You must be signed in to change notification settings

mohammadumar-dev/pathlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PathLab - Pathology Laboratory Management System

A comprehensive full-stack application for managing pathology laboratory operations, including patient management, test bookings, sample tracking, test results, payment processing, and administrative dashboards.

πŸ“‹ Project Overview

PathLab is an enterprise-grade laboratory information management system (LIMS) that digitally transforms pathology laboratory operations. The system provides end-to-end workflow automation from test booking through result generation and delivery, serving patients, healthcare providers, laboratory staff, and administrators through intuitive web interfaces backed by a robust REST API.

Who It's For

  • Patients: Book tests online, view and download results securely, manage appointments, and track payment history
  • Laboratory Technicians: Manage sample collection and tracking, record test results, and handle specimen workflows
  • Doctors: Monitor patient test results and access comprehensive medical data
  • Administrative Personnel: Oversee laboratory operations, manage users and tests, track financial metrics, and generate analytics
  • Pathology Laboratories: Modern diagnostic centers seeking to streamline operations and improve patient experience

Core Objectives

  • Automate manual laboratory processes and reduce turnaround time
  • Minimize human errors in result reporting and data management
  • Improve patient experience through digital accessibility and transparency
  • Enhance data security with JWT authentication and role-based access control
  • Enable real-time tracking of samples and test status
  • Provide comprehensive analytics and business intelligence
  • Ensure scalability and maintainability through modern architecture

✨ Key Features

Patient Portal

  • User registration with email verification
  • Secure JWT-based authentication and authorization
  • Appointment scheduling and test booking
  • Browse comprehensive test catalog with pricing information
  • Payment tracking and invoice generation (offline payments)
  • Secure digital report access with PDF download
  • Historical test results and booking history
  • Real-time notifications via email

Laboratory Management

  • Multi-status sample lifecycle tracking (collection pending, collected, in transit, received, tested, discarded)
  • Sample collection assignment to lab technicians
  • Parametric test result entry and updates
  • Quality control measures and validation
  • Barcode generation for sample identification
  • Centralized test catalog with parameter definitions

Administrative Dashboard

  • Comprehensive user and staff management
  • Business analytics with monthly booking trends
  • Test distribution analysis
  • Recent activity logs and audit trails
  • Role-based access control (ADMIN, LAB_TECH, DOCTOR, PATIENT)
  • System-wide statistics and KPIs

Reporting & Documents

  • PDF report generation with Freemarker templates
  • Customizable report layouts
  • Invoice PDF generation for payments
  • Digital signature support (planned)
  • Export and sharing functionality
  • Bulk report processing capabilities

Additional Features

  • Cloudinary integration for image storage
  • Email notifications for verification, password recovery, and test results
  • Caffeine caching for performance optimization
  • Database version control with Flyway migrations
  • Comprehensive input validation with error handling
  • CORS configuration for secure frontend-backend integration

πŸ—οΈ Architecture Overview

PathLab follows a modern full-stack architecture with clear separation of concerns:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    React Frontend                       β”‚
β”‚         (TypeScript, Vite, Tailwind CSS)                β”‚
β”‚    Components β†’ Pages β†’ API Services β†’ Hooks            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ REST API (JSON)
                     β”‚ JWT Authentication
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Spring Boot Backend                        β”‚
β”‚    Controller β†’ Service β†’ Repository β†’ Entity           β”‚
β”‚         (Java 21, Spring Security, JPA)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ JDBC
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              PostgreSQL Database                        β”‚
β”‚         (Relational data storage)                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

External Integrations:
β”œβ”€β”€ Cloudinary (Image storage)
β”œβ”€β”€ Email Service (SMTP notifications)
└── PDF Generation (OpenHTML2PDF + Freemarker)

Backend Architecture (Spring Boot)

The backend follows a layered architecture pattern:

Controller Layer (REST endpoints)
     ↓
Service Layer (Business logic)
     ↓
Repository Layer (Data access with Spring Data JPA)
     ↓
Entity/Domain Models
     ↓
PostgreSQL Database

Functional Modules:

  • Authentication & Authorization
  • Patient Management
  • Test Catalog Management
  • Booking & Appointment System
  • Sample Collection & Tracking
  • Test Results Recording
  • Payment Processing
  • Dashboard & Analytics
  • PDF Generation & Email Services

Frontend Architecture (React)

The frontend uses a component-based architecture:

Pages (Route-based screens)
  ↓
Components (Reusable UI with Radix UI)
  ↓
API Services (Backend integration)
  ↓
Hooks (Custom React logic)
  ↓
Contexts (Global state management)

πŸ› οΈ Tech Stack

Backend Technologies

  • Runtime: Java 21 (Eclipse Temurin)
  • Framework: Spring Boot 3.5.5
  • Security: Spring Security with JWT authentication (JJWT 0.11.5)
  • Database: PostgreSQL (primary) + Spring Data JPA (Hibernate ORM)
  • Migration: Flyway (database version control)
  • Email: Spring Mail (SMTP)
  • Caching: Caffeine 3.1.8 (in-memory)
  • PDF Generation: OpenHTML2PDF with PDFBox
  • Templates: Freemarker (PDF and email templates)
  • Storage: Cloudinary HTTP5 (cloud image storage)
  • Build Tool: Apache Maven 3.9.9
  • Utilities: Lombok (boilerplate reduction)

Frontend Technologies

  • Framework: React 18.3.1 with TypeScript 5.5.3
  • Build Tool: Vite 7.1.2 (fast HMR and optimized builds)
  • UI Components: Radix UI (accessible primitives)
  • Styling: Tailwind CSS 3.4.13 with custom animations
  • Routing: React Router DOM 7.8.0
  • Forms: React Hook Form 7.53.0 + Zod 3.23.8 (validation)
  • State Management: React Context API
  • HTTP Client: Fetch API with custom ApiClient wrapper
  • Charts: Recharts 3.1.2
  • Date Handling: date-fns 3.6.0 + react-datepicker 8.7.0
  • PDF Export: jsPDF 3.0.2 + html2canvas 1.4.1
  • Animations: Framer Motion 12.23.12
  • Icons: Lucide React 0.539.0 + Radix UI Icons
  • Notifications: Sonner 1.5.0 (toast notifications)
  • Code Quality: ESLint 9.11.1 with TypeScript support

DevOps & Tooling

  • Containerization: Docker (multi-stage builds)
  • Version Control: Git
  • API Documentation: Swagger/OpenAPI (if configured)
  • Package Management: Maven (backend), npm (frontend)
  • Deployment: Netlify (frontend), Render/Cloud providers (backend)

πŸ“ Project Structure

pathlab/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ pathlab-backend/                    # Spring Boot backend application
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ java/com/pathlab/
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ config/             # Security & app configuration
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SecurityConfig.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ CorsConfig.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   └── FreemarkerConfig.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ controller/         # REST API endpoints
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ AuthController.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PatientController.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ BookingsController.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SampleController.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PaymentController.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ BookingResultsController.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   └── DashboardController.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ dto/                # Request/response models
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ booking/
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ patient/
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ payment/
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ result/
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   └── dashboard/
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ entity/             # JPA domain entities
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ User.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Patient.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Booking.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Sample.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ TestEntity.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ TestResult.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Payment.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   └── enums/          # Domain enumerations
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ repository/         # Spring Data JPA repositories
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ UserRepository.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PatientRepository.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ BookingRepository.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SampleRepository.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ TestEntityRepository.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   └── PaymentRepository.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ service/            # Business logic layer
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ AuthService.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PatientService.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ BookingService.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SampleService.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ TestService.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ TestResultService.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PaymentService.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ DashboardService.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ EmailService.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   └── PdfService.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ security/           # JWT filters & handlers
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   └── JwtAuthenticationFilter.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ exception/          # Global exception handling
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   └── GlobalExceptionHandler.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ util/               # Utility helpers
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ JwtUtil.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚   └── DateUtils.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”‚   β”‚   └── PathLabApplication.java  # Spring Boot entry
β”‚   β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”‚   └── resources/
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ application.properties  # App configuration
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ db/migration/           # Flyway migrations
β”‚   β”‚   β”‚   β”‚       β”‚   └── V1__init.sql
β”‚   β”‚   β”‚   β”‚       └── templates/              # Freemarker templates
β”‚   β”‚   β”‚   β”‚           β”œβ”€β”€ email/
β”‚   β”‚   β”‚   β”‚           β”‚   β”œβ”€β”€ verification.html
β”‚   β”‚   β”‚   β”‚           β”‚   └── report-template.html
β”‚   β”‚   β”‚   β”‚           β”œβ”€β”€ invoice.ftl
β”‚   β”‚   β”‚   β”‚           └── report.ftl
β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   └── test/                           # Unit & integration tests
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ Dockerfile                          # Backend containerization
β”‚   β”‚   β”œβ”€β”€ pom.xml                             # Maven dependencies
β”‚   β”‚   β”œβ”€β”€ mvnw / mvnw.cmd                     # Maven wrapper
β”‚   β”‚   └── .gitignore
β”‚   β”‚
β”‚   └── pathlab-frontend/                       # React frontend application
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ pages/                          # Route-based page components
β”‚       β”‚   β”‚   β”œβ”€β”€ HomePage.tsx
β”‚       β”‚   β”‚   β”œβ”€β”€ LoginPage.tsx
β”‚       β”‚   β”‚   β”œβ”€β”€ PatientDashboard.tsx
β”‚       β”‚   β”‚   β”œβ”€β”€ AdminDashboard.tsx
β”‚       β”‚   β”‚   β”œβ”€β”€ BookingPage.tsx
β”‚       β”‚   β”‚   β”œβ”€β”€ ResultsPage.tsx
β”‚       β”‚   β”‚   └── ...
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ components/                     # Reusable UI components
β”‚       β”‚   β”‚   β”œβ”€β”€ ui/                         # Radix UI primitives
β”‚       β”‚   β”‚   β”œβ”€β”€ layout/                     # Layout components
β”‚       β”‚   β”‚   β”œβ”€β”€ forms/                      # Form components
β”‚       β”‚   β”‚   └── ...
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ api/                            # Backend integration
β”‚       β”‚   β”‚   β”œβ”€β”€ index.ts                    # Base API client
β”‚       β”‚   β”‚   β”œβ”€β”€ auth.ts                     # Auth endpoints
β”‚       β”‚   β”‚   β”œβ”€β”€ tests.ts                    # Test management
β”‚       β”‚   β”‚   β”œβ”€β”€ bookings.ts                 # Booking endpoints
β”‚       β”‚   β”‚   └── ...
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ hooks/                          # Custom React hooks
β”‚       β”‚   β”‚   β”œβ”€β”€ useAuth.ts
β”‚       β”‚   β”‚   β”œβ”€β”€ useForm.ts
β”‚       β”‚   β”‚   └── ...
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ contexts/                       # Global state management
β”‚       β”‚   β”‚   β”œβ”€β”€ AuthContext.tsx
β”‚       β”‚   β”‚   └── UserContext.tsx
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ lib/                            # Utility functions
β”‚       β”‚   β”‚   └── utils.ts
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ App.tsx                         # Root component
β”‚       β”‚   β”œβ”€β”€ main.tsx                        # Entry point
β”‚       β”‚   β”œβ”€β”€ index.css                       # Global styles
β”‚       β”‚   └── vite-env.d.ts                   # Type definitions
β”‚       β”‚
β”‚       β”œβ”€β”€ public/                             # Static assets
β”‚       β”œβ”€β”€ index.html                          # HTML entry point
β”‚       β”œβ”€β”€ vite.config.ts                      # Vite configuration
β”‚       β”œβ”€β”€ tailwind.config.js                  # Tailwind CSS config
β”‚       β”œβ”€β”€ tsconfig.json                       # TypeScript config
β”‚       β”œβ”€β”€ package.json                        # Dependencies & scripts
β”‚       β”œβ”€β”€ eslint.config.js                    # ESLint configuration
β”‚       β”œβ”€β”€ netlify.toml                        # Deployment config
β”‚       └── .gitignore
β”‚
β”œβ”€β”€ README.md                                   # This file
β”œβ”€β”€ CONTRIBUTING.md                             # Contribution guidelines
└── .git/                                       # Git version control

πŸš€ Getting Started

Prerequisites

Backend:

  • Java 21 or later (Eclipse Temurin recommended)
  • Maven 3.9.9 or later
  • PostgreSQL 12 or later
  • Git

Frontend:

  • Node.js 18.x or higher
  • npm 9.x or higher (or yarn)

Environment Setup

Backend Configuration

  1. Install PostgreSQL and create a database:

    createdb pathlab
  2. Navigate to backend directory:

    cd app/pathlab-backend
  3. Configure environment variables in application.properties or as system environment variables:

    # Database Configuration
    DB_URL=jdbc:postgresql://localhost:5432/pathlab
    DB_USERNAME=postgres
    DB_PASSWORD=your_password
    
    # Cloudinary Configuration
    CLOUDINARY_CLOUD_NAME=your-cloud-name
    CLOUDINARY_API_KEY=your-api-key
    CLOUDINARY_API_SECRET=your-api-secret
    
    # Email Configuration
    MAIL_USERNAME=your-email@gmail.com
    MAIL_PASSWORD=your-app-password
    
    # Security & JWT
    JWT_SECRET_BASE64=your-base64-encoded-secret
    
    # Application URLs
    PUBLIC_BASE_URL=http://localhost:5173

Frontend Configuration

  1. Navigate to frontend directory:

    cd app/pathlab-frontend
  2. Create .env.local file in the frontend root:

    # Backend API Configuration
    VITE_API_BASE_URL=http://localhost:8080/api
    
    # Authentication
    VITE_AUTH_TIMEOUT=3600000
    
    # Feature Flags
    VITE_ENABLE_DEMO_MODE=false
    
    # Notification Settings
    VITE_TOAST_DURATION=3000
    
    # Application Name
    VITE_APP_NAME=Pathology Lab Management System

Installation Steps

Backend Setup

  1. Navigate to backend directory:

    cd app/pathlab-backend
  2. Build the application using Maven:

    ./mvnw clean package

    On Windows:

    mvnw.cmd clean package
  3. Run the application:

    ./mvnw spring-boot:run

    Or after packaging:

    java -jar target/pathlab-0.0.1-SNAPSHOT.jar
  4. Verify backend is running:

    • Backend API available at: http://localhost:8080
    • API documentation (if Swagger configured): http://localhost:8080/swagger-ui.html

Frontend Setup

  1. Navigate to frontend directory:

    cd app/pathlab-frontend
  2. Install dependencies:

    npm install
  3. Start development server:

    npm run dev
  4. Access the application:

    • Frontend available at: http://localhost:5173 (default Vite port)

Running the Full Stack

For development, run both applications simultaneously:

Terminal 1 (Backend):

cd app/pathlab-backend
./mvnw spring-boot:run

Terminal 2 (Frontend):

cd app/pathlab-frontend
npm run dev

The frontend will proxy API requests to the backend automatically.

πŸ’» Development Workflow

Backend Development

Running Tests:

cd app/pathlab-backend
./mvnw test

Building the Application:

./mvnw clean package -DskipTests

Useful Maven Commands:

# Clean build
./mvnw clean

# Compile only
./mvnw compile

# Run tests
./mvnw test

# Package without tests
./mvnw package -DskipTests

# View dependency tree
./mvnw dependency:tree

# Format code (if spotless configured)
./mvnw spotless:apply

Available API Endpoints:

Authentication:

POST /api/auth/register/patient
POST /api/auth/register/user
POST /api/auth/login
POST /api/auth/logout
GET  /api/auth/verify-email?token=...
POST /api/auth/forgot-password
POST /api/auth/reset-password

Patient Management:

GET    /api/patients
GET    /api/patients/{id}
POST   /api/patients
PUT    /api/patients/{id}
DELETE /api/patients/{id}

Bookings:

GET    /api/bookings
GET    /api/bookings/{id}
POST   /api/bookings
PUT    /api/bookings/{id}
DELETE /api/bookings/{id}

Test Results & PDF Generation:

POST /api/bookings/{bookingId}/tests/{testId}/results
GET  /api/bookings/{bookingId}/results
GET  /api/bookings/{bookingId}/results/pdf
GET  /api/payments/{id}/invoice/pdf

Frontend Development

Available Scripts:

# Start development server with HMR
npm run dev

# Build for production
npm run build

# Preview production build locally
npm run preview

# Run ESLint checks
npm run lint

Script Details:

  • dev: Starts Vite development server with fast refresh at http://localhost:5173
  • build: Compiles TypeScript and builds optimized production bundle to dist/
  • lint: Analyzes code for errors and style issues using ESLint
  • preview: Serves the built application locally for testing

Code Quality Standards

Backend:

  • Follow Java naming conventions (PascalCase for classes, camelCase for methods)
  • Use Lombok annotations for boilerplate reduction
  • Add validation to all DTOs using Jakarta validation annotations
  • Include appropriate error handling with custom exceptions
  • Write meaningful commit messages
  • Document complex business logic
  • Test your changes before submitting

Frontend:

  • Use TypeScript strict mode for all components
  • Follow React Hooks conventions and best practices
  • Write self-documenting, readable code
  • Use Tailwind CSS utility classes (avoid inline styles)
  • Create reusable components following single responsibility principle
  • Ensure all components are properly typed
  • Document complex logic with comments
  • Test changes thoroughly in browser

🚒 Deployment

Backend Deployment (Docker)

The backend includes a multi-stage Dockerfile for containerization:

  1. Build the Docker image:

    cd app/pathlab-backend
    docker build -t pathlab-backend:latest .
  2. Run the container:

    docker run -d \
      -p 8080:8080 \
      -e DB_URL=jdbc:postgresql://postgres:5432/pathlab \
      -e DB_USERNAME=postgres \
      -e DB_PASSWORD=your_password \
      -e MAIL_USERNAME=your-email@gmail.com \
      -e MAIL_PASSWORD=your-app-password \
      -e JWT_SECRET_BASE64=your-secret \
      -e CLOUDINARY_CLOUD_NAME=your-cloud-name \
      -e CLOUDINARY_API_KEY=your-api-key \
      -e CLOUDINARY_API_SECRET=your-api-secret \
      pathlab-backend:latest

Frontend Deployment (Netlify)

The frontend is configured for Netlify deployment (see netlify.toml):

  1. Build Command: npm run build
  2. Publish Directory: dist/
  3. Node Version: 18.x or higher

Environment Configuration for Deployment:

  • Development: http://localhost:8080/api
  • Production: https://pathology-lab-backend-new.onrender.com/api

Production Deployment Checklist

Backend:

  • Environment variables securely configured
  • PostgreSQL connection pooling optimized
  • HTTPS/TLS enabled for all endpoints
  • Logging and monitoring configured
  • Rate limiting implemented for API endpoints
  • Reverse proxy (Nginx/Apache) configured
  • CORS settings updated for production frontend URL
  • Secrets management system implemented
  • Audit logging enabled for sensitive operations
  • Database backups configured
  • Health check endpoints verified

Frontend:

  • Production API URL configured in environment variables
  • Backend API accessibility verified
  • Production build tested locally
  • TypeScript compilation successful
  • ESLint checks passing
  • Static assets optimized
  • Error tracking configured (e.g., Sentry)
  • Analytics implemented (if required)
  • Browser compatibility tested
  • Performance metrics verified

Production Considerations

  • Use environment variables for all sensitive configuration
  • Enable comprehensive logging and monitoring
  • Implement proper error tracking and alerting
  • Configure database connection pooling appropriately
  • Use a CDN for static assets (frontend)
  • Enable compression for API responses
  • Implement proper CORS policies
  • Set up automated backups for database
  • Configure SSL/TLS certificates
  • Implement rate limiting and DDoS protection
  • Use a reverse proxy for the backend
  • Enable API response caching where appropriate
  • Monitor application performance and resource usage

πŸ—ΊοΈ Roadmap & Future Improvements

Planned Features

  1. Enhanced Notifications

    • SMS notifications for booking confirmations and results
    • Push notifications via Progressive Web App (PWA)
    • WhatsApp integration for report delivery
    • Configurable notification preferences
  2. Payment Integration

    • Online payment gateway integration (Stripe, PayPal, Razorpay)
    • Automated invoice generation
    • Payment reminders and receipts
    • Multi-currency support
  3. Advanced Analytics

    • Comprehensive business intelligence dashboards
    • Revenue forecasting and trend analysis
    • Patient demographics and test distribution insights
    • Exportable reports in multiple formats
  4. Mobile Experience

    • Progressive Web App (PWA) implementation
    • Offline functionality with service workers
    • Mobile-optimized dashboards and workflows
    • Native mobile app (React Native)
  5. Internationalization

    • Multi-language support (i18n)
    • Localized date and currency formats
    • Regional compliance features
  6. Enhanced Features

    • Document storage for patient records and consents
    • Automated scheduling for sample collection
    • Integration with external lab equipment APIs
    • Real-time booking notifications via WebSockets
    • Advanced search and filtering capabilities
    • Batch processing for multiple samples/tests
    • Digital signature for authorized personnel
    • Audit trail with detailed logging
  7. UI/UX Improvements

    • Dark mode full implementation
    • Interactive tutorials and onboarding
    • Customizable user preferences
    • Accessibility enhancements (WCAG 2.1 AA compliance)
    • Advanced data visualization
  8. Performance Optimization

    • Redis caching for improved performance
    • Code splitting and lazy loading (frontend)
    • Image optimization and CDN integration
    • API response caching strategies
    • Database query optimization
    • Background job processing
  9. Testing & Quality

    • Comprehensive unit test coverage
    • Integration tests for critical workflows
    • End-to-end testing with Playwright/Cypress
    • Load testing and performance benchmarks
    • Security auditing and penetration testing
  10. DevOps & Infrastructure

    • CI/CD pipeline automation
    • Kubernetes deployment configuration
    • Monitoring and alerting with Prometheus/Grafana
    • Automated database backups and recovery
    • Infrastructure as Code (Terraform)

πŸ“ License

This project is proprietary software. All rights reserved.

πŸ‘₯ Team & Support

For questions, issues, or contributions, please refer to CONTRIBUTING.md.

Project Maintainers:

Repository Links:

  • Monorepo: https://github.com/mohammadumar-dev/pathlab

Built with ❀️ for modern pathology laboratories

About

Full-stack pathology laboratory management system built with Spring Boot and React. Features patient management, test booking, sample tracking, result generation with PDF reports, and admin dashboards. JWT authentication, PostgreSQL database, and modern UI with Tailwind CSS.

Topics

Resources

License

Contributing

Stars

Watchers

Forks