A minimal, production-focused REST API built with Spring Boot for managing employee data. Demonstrates clean architecture with DTOs, layered services, and Gradle-driven build conventions—ready for integration with third-party platforms.
Features: 3 REST endpoints (list, retrieve, create employees) | In-memory repository | DTO separation | Spotless formatting enforcement | Java 21.
-- Quick links
- Controller: api/src/main/java/com/challenge/api/controller/EmployeeController.java
- Service: api/src/main/java/com/challenge/api/service/EmployeeService.java
- Model: api/src/main/java/com/challenge/api/model/EmployeeImpl.java
- DTOs: api/src/main/java/com/challenge/api/dto
- REST endpoints for listing, retrieving (by UUID), and creating employees
- Simple in-memory repository for demonstration and tests
- Clear DTO separation:
CreateEmployeeRequestandEmployeeResponse - Formatting enforced by Spotless and shared Gradle conventions
- JDK 21 installed
- Gradle wrapper is included — recommended usage via the provided wrapper scripts
From the repository root run:
Windows PowerShell
.\gradlew.bat :api:bootRunBuild (includes formatting check):
.\gradlew.bat buildFormat code (applies Spotless rules):
.\gradlew.bat spotlessApplySee docs/API.md for a complete reference including request/response examples and sample curl commands.
api/— Spring Boot application modulesrc/main/java/com/challenge/api— application sourcescontroller/— REST controllersservice/— business logicrepository/— in-memory data store for demomodel/— domain model objectsdto/— API request/response objects
src/main/resources/application.yml— app configuration
buildSrc/— shared Gradle conventions (Spotless, versions)gradle/wrapper— wrapper binaries configuration
Below is a concise coding-structure view showing where to find responsibilities in the codebase:
entry-level-java-challenge-master/
├─ api/
│ ├─ src/main/java/com/challenge/api/
│ │ ├─ controller/ # HTTP endpoints (EmployeeController)
│ │ ├─ service/ # Business logic (EmployeeService)
│ │ ├─ repository/ # Data access / in-memory store
│ │ ├─ model/ # Domain objects (Employee, EmployeeImpl)
│ │ └─ dto/ # API request/response DTOs
│ └─ src/main/resources/ # app configuration (application.yml)
├─ buildSrc/ # Shared Gradle conventions (Spotless, plugin rules)
└─ gradle/wrapper/ # Gradle wrapper configuration
Guidelines:
- Keep controllers thin: delegate validation and business rules to
service. - Service layer contains orchestration and policies; repository is a lightweight data store for this exercise.
- Use DTOs for all external-facing request/response objects to keep the internal model stable.
- Run
./gradlew.bat spotlessApplybefore committing to ensure consistent formatting.
- Keep the API stable: prefer adding new DTOs rather than changing existing response shapes.
- Spotless is configured in
buildSrc— runspotlessApplybefore committing.
The REST API endpoints were tested using Postman.
📬 Postman Collection:
Employee Management API Collection
See docs/CONTRIBUTING.md for coding style and commit guidance.
If you'd like, I can now: (a) start the app and run the three endpoints automatically, or (b) add a minimal test suite to exercise endpoints. Which do you prefer?