A production-ready Spring Boot RESTful API for managing a clinic system. This project demonstrates clean architecture, secure authentication, and scalable backend design using modern Java technologies.
The Clinic Management System provides backend services for:
- 👨⚕️ Doctor management
- 🧑🤝🧑 Patient management
- 📅 Appointment scheduling
- 🔐 Authentication & authorization
- 📊 Data persistence with relational database
- 🧪 Unit & integration testing
This project follows best practices for layered architecture and REST API design.
The project follows a layered architecture:
Controller → Service → Repository → Database
-
Controller Layer
- Handles HTTP requests
- Input validation
- API responses
-
Service Layer
- Business logic
- Transaction management
- Domain rules enforcement
-
Repository Layer
- Database interaction using JPA
- Query abstraction
-
Entity Layer
- Database models
- ORM mapping
- Java 17+
- Spring Boot
- Spring Web
- Spring Data JPA
- Spring Security
- Hibernate
- PostgreSQL / MySQL (configurable)
- H2 (for development/testing)
- JWT Authentication
- Role-Based Authorization
- Password Encryption (BCrypt)
- JUnit 5
- Mockito
- Spring Boot Test
- Docker
- Docker Compose
The system uses:
- JWT-based authentication
- Stateless session management
- Role-based access control (e.g., ADMIN, DOCTOR, PATIENT)
Typical flow:
- User logs in
- Server returns JWT token
- Client includes token in Authorization header
- Backend validates token for secured endpoints
src/main/java/
│
├── controller/
├── service/
├── repository/
├── entity/
├── dto/
├── exception/
├── security/
└── config/
- Create doctor
- Update doctor
- Delete doctor
- View doctor details
- Register patient
- Update patient data
- View patient records
- Create appointment
- Prevent scheduling conflicts
- List appointments by doctor or patient
- Custom exceptions
- Meaningful API error responses
- Centralized error management
- RESTful endpoints
- Proper HTTP status codes
- DTO usage (no entity exposure)
- Validation annotations
- Pagination & sorting support (if implemented)
Example:
GET /api/doctors
POST /api/patients
PUT /api/appointments/{id}
DELETE /api/doctors/{id}
Includes:
- Unit tests for service layer
- Mocking dependencies using Mockito
- Integration testing for API endpoints
To run tests:
mvn test
Build the project:
mvn clean package
Build Docker image:
docker build -t clinic-app .
Run container:
docker run -p 8080:8080 clinic-app
Or use Docker Compose:
docker-compose up
Application configuration is managed in:
application.yml
You can configure:
- Database URL
- Username & password
- JWT secret
- Server port
- Logging level
- Swagger / OpenAPI documentation
- Advanced filtering & search
- Caching with Redis
- Audit logging
- CI/CD pipeline
- Kubernetes deployment
This project demonstrates:
- Clean backend architecture
- Secure REST API development
- Database modeling & relationships
- Proper exception handling
- Real-world backend structure
- Production-ready configuration mindset
Ali Al-Jalo
Java Backend Developer