A web application for managing hospital operations including patient registration, doctor appointments, and medical records.
- Tech Stack
- Prerequisites
- Environment Variables
- Setup Instructions
- Run Commands
- Authentication
- API Documentation
- Backend: Java17 , Spring Boot, Spring Security, Spring Data JPA
- Frontend: React , TypeScript, Vite
- Database: MySQL 8
- Authentication: JWT + Google OAuth2
- Containerization: Docker , Docker Compose
- CI/CD: GitHub Actions
- APIDocs: Swagger / OpenAPI 3
- Docker and Docker Compose
- Java 17+
- Node.js 18+
- Docker & Docker Compose
- MySQL 8 (if running locally without Docker)
- Maven 3.8+
Copy .env.example to .env and fill in the values:
cp .env.example .envDB_URL=jdbc:mysql://db:3306/hospital_db
DB_USERNAME=your_db_username
DB_PASSWORD=your_db_password
GOOGLE_CLIENT_ID=your_client_id //From Google Cloud Console
GOOGLE_CLIENT_SECRET=your_client_secret //From Google Cloud Console
JWT_SECRET=your_jwt_secret_min_32_chars
JWT_EXPIRATION=3600000 //1 hour# 1. Clone the repository
git clone https://github.com/HMS-SWE/Hospital-website.git
cd Hospital-website
# 2. Create environment file
cp .env.example .env
# Edit .env with your values
# 3. Start all services
docker compose up --buildServices will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
- Swagger UI: http://localhost:8080/swagger-ui/index.html
cd backend
# Set environment variables (or use .env file with spring-dotenv)
export DB_URL=jdbc:mysql://localhost:3306/hospital_db
export DB_USERNAME=root
export DB_PASSWORD=yourpassword
export APP_JWT_SECRET=your-secret-key-min-32-characters
export APP_JWT_EXPIRATION=3600000
export GOOGLE_CLIENT_ID=your-client-id
export GOOGLE_CLIENT_SECRET=your-client-secret
# Run the backend
mvn spring-boot:runcd frontend
# Install dependencies
npm install
# Start development server
npm run dev# Start all services
docker compose up
# Start with rebuild
docker compose up --build
# Stop all services
docker compose down
# View logs
docker logs hospital-backend
docker logs hospital-frontend
docker logs hospital-dbcd backend
# Run application
mvn spring-boot:run
# Run tests
mvn test
# Run tests with coverage report
mvn test jacoco:report
# Build JAR
mvn clean packagecd frontend
# Install dependencies
npm install
# Start dev server
npm run dev
# Build for production
npm run build
# Run linter
npm run lintPOST /api/auth/login
GET /oauth2/authorization/google New users are automatically registered as patients.
cd backend
mvn testSwagger UI is available at: http://localhost:8080/swagger-ui/index.html
OpenAPI JSON spec: http://localhost:8080/v3/api-docs
- All passwords are hashed using BCrypt
- JWT tokens expire after 1 hour by default
- Google OAuth2 is used for patient self-registration
- Branch protection rules enforce CI checks before merging
- Secrets are stored in
.env— never in code or GitHub