TasksApp is a robust, production-ready RESTful API designed for efficient task and to-do list management. Built with Java 21 and Spring Boot 3, this project demonstrates modern backend engineering practices, including clean architecture, comprehensive automated testing, and secure, containerized deployment.
- Clean Architecture: Strict separation of concerns using the Layered Architecture pattern (Controllers, Services, Repositories).
- Domain Isolation: Implementation of the DTO Pattern using Java Records and explicit Mappers to decouple the database entities from the presentation layer.
- Resilient Infrastructure: Fully containerized environment using Docker & Docker Compose with persistent volumes, database healthchecks, and memory limits.
- Security First: Zero-trust configuration using
.envfiles for secrets management and anon-rootuser strategy within the Dockerfile. - Idempotent Data Seeding: Automated test data initialization via
CommandLineRunnerensuring safe execution across multiple deployments. - Deterministic Testing: High-quality unit test suite utilizing Mockito, JUnit 5, the Factory Pattern (Object Mother), and a fixed
TestClockto prevent flaky tests.
- Java 21 (LTS)
- Spring Boot 3 (Web, Data JPA, Validation)
- Hibernate (ORM)
- Lombok (Boilerplate reduction)
- MySQL (Relational Database)
- Docker & Docker Compose (Containerization & Orchestration)
- Maven (Dependency & Build Management)
- JUnit 5 & Mockito (Unit Testing)
- JaCoCo (Code Coverage Analysis)
- Springdoc OpenAPI (Swagger UI)
- Postman (API Collection included)
The project follows a standardized layered architectural pattern:
๐ฆ tasksapp
โฃ ๐ src/main/java/com/matiasbarraza/tasksapp
โ โฃ ๐ config # Global configurations (Swagger, Clock, Data Seeding)
โ โฃ ๐ controllers # REST API Endpoints
โ โฃ ๐ domain # Entities, Enums, and DTO Records
โ โฃ ๐ exceptions # Global exception handling architecture
โ โฃ ๐ mappers # DTO to Entity mapping logic
โ โฃ ๐ repositories # Spring Data JPA Interfaces
โ โ ๐ services # Business logic implementation
โฃ ๐ postman # Postman collection for manual testing
โฃ ๐ docker-compose.yml
โฃ ๐ Dockerfile
โฃ ๐ .env.template
โ ๐ pom.xml
The API is fully documented using the OpenAPI specification. Once the application is running, you can explore and interact with all endpoints directly through the Swagger UI web portal.
- Local Web URL: http://localhost:8080/api/swagger-ui/index.html (Note: The port may vary based on your local configuration).
| Resource | HTTP Methods | Description |
|---|---|---|
/api/v1/task-lists |
GET, POST, PUT, DELETE |
Manage task lists. |
/api/v1/task-lists/{taskListId}/tasks |
GET, POST, PUT, DELETE |
Manage tasks within a specific list. |
Incoming requests are rigorously validated at the controller layer using Jakarta Validation constraints to ensure data integrity before reaching the service layer.
- Required fields verification.
- Non-empty titles and maximum character length restrictions.
- Date constraints (e.g., ensuring due dates are scheduled in the future).
A robust exception handling mechanism is implemented globally using @ControllerAdvice. This catches system anomalies, validation failures, or illegal arguments, translating them into standard, predictable JSON responses.
{
"status": 400,
"message": "Title is required",
"details": "uri=/api/v1/tasks",
"timestamp": "2026-07-07T12:00:00"
}Quality assurance is a core pillar of this codebase. The business layer is thoroughly covered against edge cases and invalid parameters.
- Coverage Target: Strict
>80%line coverage enforced by JaCoCo (excluding structural configuration and plain DTO classes). - Deterministic Execution: Time-sensitive business rules are verified using a custom
TestClockto ensure consistent assertions regardless of the host execution environment.
For rapid manual testing, a complete Postman collection is included directly within the repository.
- File Location:
postman/TasksAppCollection.json - Features: Pre-configured payloads and parameters for every single available endpoint.
To align with security best practices, the application Docker image drops root privileges during the build stage and runs under a dedicated, isolated environment user.
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring- Benefits: Drastically reduced attack surface, tight container isolation, and production-grade reliability.
Configuration parameters and sensitive database credentials are fully decoupled from the code via an environment file.
# Example .env layout
DB_URL=jdbc:mysql://mysql:3306/tasks_db?createDatabaseIfNotExist=true&useSSL=false&serverTimezone=UTC
DB_USER=tasksuser
DB_PASS=taskspassword
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=tasks_dbFollow these steps to spin up the application on your workspace.
- Docker & Docker Compose installed.
- (Optional) Java 21 SDK and Maven if you wish to run the app natively outside containers.
- Clone the repository:
git clone https://github.com/Matias-Barraza/tasksapp.git cd tasksapp - Initialize your local configuration file from the template:
(The default parameters are pre-configured to automatically link with the Docker infrastructure).
cp .env.template .env
This compiles the application using a multi-stage Dockerfile and deploys the backend alongside a health-checked MySQL instance.
docker compose up -d --build- API Base URL:
http://localhost:8080/api/v1/ - Swagger Documentation:
http://localhost:8080/api/swagger-ui/index.html
Ensure you have a local instance of MySQL matching the credentials defined in your .env file before executing:
./mvnw spring-boot:runPlanned roadmap items to further expand the technical depth of this project:
- Security Enhancement: Integrate Spring Security with stateful/stateless JWT Authentication & Role-Based Authorization.
- Database Versioning: Implement Flyway or Liquibase database migrations.
- Advanced Testing: Integrate Testcontainers for real-database integration tests.
- CI/CD Pipeline: Configure GitHub Actions for automated building, linting, and coverage reporting.
- API Features: Introduce Pagination, Advanced Filtering, and dynamic Sorting to the endpoints.
- Operations: Add Rate Limiting, request throttling, and comprehensive metric monitoring/observability tools.
Matias Barraza
- LinkedIn: linkedin.com/in/matias--barraza
- Email: matiasbarraza292@gmail.com


