CCH (Cyclo Club Horizon) is a REST API designed to manage cycling time trial competitions. The system handles cyclists, teams, competitions, stages, and results management, providing a comprehensive solution for organizing and managing cycling events.
-
Cyclist Management
- Register new cyclists with personal details
- Update cyclist information
- View cyclists with sorting options (name, nationality, team)
- Remove cyclists from the system
-
Team Management
- Create and manage cycling teams
- Associate cyclists with teams
- View team details and roster
-
Competition Management
- Create and organize competitions with details (name, date, location, distance)
- Manage competition stages
- Handle participant registration
- Track competition results
-
Results & Rankings
- Record individual stage times
- Calculate rankings automatically (via triggers)
- Generate individual and cumulative rankings
- Manage stage-specific results
- RESTful API endpoints following best practices
- Comprehensive exception handling with custom exceptions
- Global error handling using @RestControllerAdvice
- DTO pattern implementation for data transfer
- Robust data validation
- Clean architecture following DDD principles
- Domain Layer: Contains business logic and entities
- Application Layer: Houses application services and DTOs
- Infrastructure Layer: Manages persistence and external services
- Presentation Layer: Handles REST controllers and request/response models
- Framework: Spring Framework (IoC, MVC, Data JPA)
- ORM: Hibernate
- Database: Postgresql
- Build Tool: Maven
- Documentation: Swagger/OpenAPI
GET /api/v1/teams
GET /api/v1/teams/{id}
POST /api/v1/teams
PUT /api/v1/teams/{id}
DELETE /api/v1/teams/{id}
GET /api/v1/cyclists
GET /api/v1/cyclists/{id}
POST /api/v1/cyclists
PUT /api/v1/cyclists/{id}
DELETE /api/v1/cyclists/{id}
GET /api/v1/competitions
GET /api/v1/competitions/{id}
POST /api/v1/competitions
PUT /api/v1/competitions/{id}
DELETE /api/v1/competitions/{id}
GET /api/v1/stages
GET /api/v1/stages/{id}
POST /api/v1/stages
PUT /api/v1/stages/{id}
DELETE /api/v1/stages/{id}
GET /api/v1/general-results
GET /api/v1/general-results/{competitionId}/{cyclistId}
POST /api/v1/general-results
DELETE /api/v1/general-results/{competitionId}/{cyclistId}
GET /api/v1/stage-results
GET /api/v1/stage-results/{stageId}/{cyclistId}
POST /api/v1/stage-results
DELETE /api/v1/stage-results/{stageId}/{cyclistId}
- SOLID principles adherence
- Design patterns implementation
- Clean architecture
- Comprehensive documentation
- Unit testing coverage
- Custom exception classes for domain-specific errors
- Global exception handling using @RestControllerAdvice
- Structured error responses
- Proper HTTP status code usage
- Separate DTOs for request and response using records
- MapStruct for object mapping
- Input validation using Bean Validation
- JUnit for unit testing
- Mockito for mocking dependencies
- TDD approach for core functionalities
- Jacoco for code coverage reports
- JDK 21
- Maven 3.6+
- Your preferred IDE
- Postman (for API testing)
-
Clone the repository
git clone https://github.com/AymaneTech/cch-cycling-mangement-in-java
-
Navigate to project directory
cd cch-cycling-management
-
Build the project
mvn clean install
-
Run the application
mvn spring-boot:run
- Configure database connection in
application.properties
- Adjust server port and other settings as needed