A modern, full-stack hospital management system built with Spring Boot and React, designed to streamline hospital operations and improve patient care management.
- Features
- Tech Stack
- Project Structure
- Getting Started
- Deployment
- API Documentation
- Contributing
- License
- π 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
- 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
- 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
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
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)
-
Navigate to the Backend directory:
cd Backend -
Configure the database:
- Update
src/main/resources/application.propertieswith your database credentials
spring.datasource.url=jdbc:mysql://localhost:3306/hospital_db spring.datasource.username=your_username spring.datasource.password=your_password
- Update
-
Build the project:
./mvnw clean install
Or on Windows PowerShell:
.\mvnw.cmd clean install
-
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
-
Navigate to the Frontend directory:
cd Frontend -
Install dependencies:
npm install
-
Configure API endpoint:
- Create a
.envfile in the Frontend directory:
VITE_API_URL=http://localhost:8080/api
- Create a
-
Start the development server:
npm run dev
The frontend will be available at
http://localhost:5173
Run both frontend and backend together with a single command:
docker-compose up -dThis 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 downTo rebuild and restart:
docker-compose up -d --buildBuild and run the backend service:
cd Backend
docker build -t hospital-backend .
docker run -p 8080:8080 hospital-backendOr on Windows PowerShell:
cd Backend
docker build -t hospital-backend .
docker run -p 8080:8080 hospital-backendBuild and run the frontend service:
cd Frontend
docker build -t hospital-frontend .
docker run -p 80:80 hospital-frontendOr on Windows PowerShell:
cd Frontend
docker build -t hospital-frontend .
docker run -p 80:80 hospital-frontendBackend 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
The frontend is automatically deployed to GitHub Pages using GitHub Actions.
Setup:
- Ensure
.github/workflows/deploy.ymlexists in theFrontenddirectory - Go to your repository Settings β Pages
- Under Source, select GitHub Actions
- Push your code to the
mainbranch 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.
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
POST /api/auth/login - User login
POST /api/auth/signup - User registration
POST /api/auth/logout - User logout
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
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.
cd Backend
./mvnw testOr on Windows PowerShell:
cd Backend
.\mvnw.cmd testcd Frontend
npm run test./mvnw spring-boot:run- Run the application./mvnw clean install- Build the project./mvnw test- Run tests
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint