Skip to content

WebDev-Knowhow/CI-CD-CloudDevops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ Hospital Management System

A modern, full-stack hospital management system built with Spring Boot and React, designed to streamline hospital operations and improve patient care management.

GitHub Actions

πŸ“‹ Table of Contents

✨ Features

  • πŸ” User Authentication - Secure login and signup functionality
  • πŸ“Š Dashboard - Comprehensive overview of hospital operations
  • πŸ‘₯ Patient Management - Track and manage patient records
  • πŸ‘¨β€βš•οΈ Doctor Management - Manage doctor profiles and schedules
  • πŸ“… Appointment Scheduling - Book and manage patient appointments
  • πŸ’Š Prescription Management - Digital prescription handling
  • πŸ“ˆ Reports & Analytics - Generate insights from hospital data
  • πŸ”” Notifications - Real-time updates and alerts
  • πŸ“± Responsive Design - Works seamlessly on all devices

πŸ› οΈ Tech Stack

Backend

  • Framework: Spring Boot 3.4.10
  • Language: Java 21
  • Build Tool: Maven
  • Database: [Your database - e.g., MySQL/PostgreSQL/MongoDB]
  • Authentication: [e.g., Spring Security, JWT]
  • Containerization: Docker

Frontend

  • Framework: React 19.1.1
  • Build Tool: Vite 7.1.7
  • Routing: React Router DOM 7.9.4
  • HTTP Client: Axios 1.12.2
  • Styling: CSS3
  • Linting: ESLint 9.36.0

πŸ“ Project Structure

hospital-management-system/
β”œβ”€β”€ Backend/                 # Spring Boot backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”œβ”€β”€ java/
β”‚   β”‚   β”‚   └── resources/
β”‚   β”‚   └── test/
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── pom.xml
β”‚
β”œβ”€β”€ Frontend/               # React frontend
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable components
β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”œβ”€β”€ assets/        # Images, icons, etc.
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   └── main.jsx
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”‚
└── .github/
    └── workflows/         # CI/CD pipelines
        └── deploy.yml

πŸš€ Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Java 21 or higher
  • Node.js 20 or higher
  • Maven 3.8+
  • Git
  • Docker (optional, for containerization)

Backend Setup

  1. Navigate to the Backend directory:

    cd Backend
  2. Configure the database:

    • Update src/main/resources/application.properties with your database credentials
    spring.datasource.url=jdbc:mysql://localhost:3306/hospital_db
    spring.datasource.username=your_username
    spring.datasource.password=your_password
  3. Build the project:

    ./mvnw clean install

    Or on Windows PowerShell:

    .\mvnw.cmd clean install
  4. Run the application:

    ./mvnw spring-boot:run

    Or on Windows PowerShell:

    .\mvnw.cmd spring-boot:run

    The backend server will start at http://localhost:8080

Frontend Setup

  1. Navigate to the Frontend directory:

    cd Frontend
  2. Install dependencies:

    npm install
  3. Configure API endpoint:

    • Create a .env file in the Frontend directory:
    VITE_API_URL=http://localhost:8080/api
  4. Start the development server:

    npm run dev

    The frontend will be available at http://localhost:5173

🐳 Docker Deployment

Quick Start with Docker Compose (Recommended)

Run both frontend and backend together with a single command:

docker-compose up -d

This will:

  • Build and start the backend on http://localhost:8080
  • Build and start the frontend on http://localhost:80
  • Create a network for inter-service communication

To stop the services:

docker-compose down

To rebuild and restart:

docker-compose up -d --build

Individual Docker Builds

Backend Docker

Build and run the backend service:

cd Backend
docker build -t hospital-backend .
docker run -p 8080:8080 hospital-backend

Or on Windows PowerShell:

cd Backend
docker build -t hospital-backend .
docker run -p 8080:8080 hospital-backend

Frontend Docker

Build and run the frontend service:

cd Frontend
docker build -t hospital-frontend .
docker run -p 80:80 hospital-frontend

Or on Windows PowerShell:

cd Frontend
docker build -t hospital-frontend .
docker run -p 80:80 hospital-frontend

Docker Features

Backend Dockerfile:

  • βœ… Multi-stage build for optimized image size
  • βœ… Maven dependency caching
  • βœ… Non-root user for security
  • βœ… Health check endpoint
  • βœ… JVM optimization for containers

Frontend Dockerfile:

  • βœ… Multi-stage build with Node.js and Nginx
  • βœ… Production-optimized Nginx configuration
  • βœ… Gzip compression enabled
  • βœ… Security headers configured
  • βœ… Static asset caching

🌐 Deployment

GitHub Pages (Frontend)

The frontend is automatically deployed to GitHub Pages using GitHub Actions.

Setup:

  1. Ensure .github/workflows/deploy.yml exists in the Frontend directory
  2. Go to your repository Settings β†’ Pages
  3. Under Source, select GitHub Actions
  4. Push your code to the main branch to trigger deployment

The site will be available at: https://yourusername.github.io/yourrepo/

Note: The GitHub Actions workflow is located in Frontend/.github/workflows/deploy.yml and automatically builds and deploys the React app when changes are pushed to the main branch.

Production Deployment

For production deployment, consider:

  • Backend: AWS EC2, Heroku, Azure App Service, Google Cloud Platform, or DigitalOcean
  • Database: AWS RDS, Azure Database, Google Cloud SQL, or managed database services
  • Frontend: Netlify, Vercel, AWS S3 + CloudFront, or Azure Static Web Apps
  • Containers: AWS ECS/EKS, Azure Container Instances, Google Kubernetes Engine, or Docker Swarm

πŸ“š API Documentation

Authentication Endpoints

POST /api/auth/login      - User login
POST /api/auth/signup     - User registration
POST /api/auth/logout     - User logout

Patient Endpoints

GET    /api/patients           - Get all patients
GET    /api/patients/{id}      - Get patient by ID
POST   /api/patients           - Create new patient
PUT    /api/patients/{id}      - Update patient
DELETE /api/patients/{id}      - Delete patient

Appointment Endpoints

GET    /api/appointments       - Get all appointments
POST   /api/appointments       - Book appointment
PUT    /api/appointments/{id}  - Update appointment
DELETE /api/appointments/{id}  - Cancel appointment

For complete API documentation, visit /api/swagger-ui.html when the backend is running.

πŸ§ͺ Running Tests

Backend Tests

cd Backend
./mvnw test

Or on Windows PowerShell:

cd Backend
.\mvnw.cmd test

Frontend Tests

cd Frontend
npm run test

πŸ“ Available Scripts

Backend

  • ./mvnw spring-boot:run - Run the application
  • ./mvnw clean install - Build the project
  • ./mvnw test - Run tests

Frontend

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run lint - Run ESLint

About

A little duff work for a tiny upload

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published