Skip to content

Luis-Morenoo/task-manager-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

41 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—‚οΈ Task Manager API

CI Quality Gate Status Coverage Security Rating

🎬 Demo

Task Manager API Demo Click to watch the full demo on YouTube


I have professional experience with Java Spring Boot in enterprise environments, but I wanted to challenge myself to build something completely from the ground up β€” no existing codebase to reference, no senior dev to ask. Just me, the docs, and a blank IntelliJ window. πŸ˜…

This is a production-ready Task Manager REST API that covers the complete lifecycle of a backend service. Built, tested, secured, containerized, deployed, and monitored. The kind of thing you'd see in enterprise environments, just without the 47 approval tickets to deploy it. πŸ˜‚

🌐 Live API: https://lm-task-manager-api.up.railway.app
πŸ“– Swagger UI: https://lm-task-manager-api.up.railway.app/swagger-ui/index.html
❀️ Health Check: https://lm-task-manager-api.up.railway.app/actuator/health

πŸ“– Technical Document: https://docs.google.com/document/d/1GVApxweT1_Df0EEk2T8ut4kvhGUatpz-WFF-VNHtlmQ/edit?usp=sharing


πŸ› οΈ Tech Stack

Category Technology
Language & Framework Java 21, Spring Boot 3.5.13
Database MongoDB Atlas (cloud-hosted NoSQL)
Caching Redis (Railway-hosted, in-memory)
Build Tool Gradle
Containerization Docker (multi-stage build)
Deployment Railway (cloud platform)
CI/CD GitHub Actions
Code Quality SonarCloud (All A grades β€” yes, really)
API Docs Swagger UI / OpenAPI 3.0
Testing JUnit 5, Mockito, Spring Boot Test
Logging SLF4J with Logback
Monitoring Spring Boot Actuator, Railway Observability

πŸ—οΈ Architecture

The API follows a clean layered architecture β€” the same pattern used in enterprise Java development, except this time I actually understand every layer because I built it myself. πŸ˜„

HTTP Request β†’ Controller β†’ Service β†’ Repository β†’ MongoDB Atlas
                                ↕
                            Redis Cache
  • Controller: Handles incoming HTTP requests and response formatting
  • Service: Contains business logic and cache management
  • Repository: Abstracts all database operations using Spring Data MongoDB
  • Redis: Caches frequently accessed data so MongoDB isn't getting hammered on every request

πŸ”„ Sequence Diagrams

Cache Miss β€” First Request

Cache Miss

Cache Hit β€” Subsequent Request

Cache Hit


πŸ“‘ API Endpoints

Method Endpoint Description
GET /api/tasks Get all tasks
GET /api/tasks/{id} Get task by ID
POST /api/tasks Create a new task
PUT /api/tasks/{id} Update a task
DELETE /api/tasks/{id} Delete a task
GET /actuator/health Health check

You can test every endpoint interactively through the Swagger UI without needing Postman. Pretty neat.


πŸ”’ Security

SonarCloud flagged several real vulnerabilities during development, all of which were fixed. This is exactly what enterprise security scanning tools do on every pull request β€” turns out those flags are there for good reason. πŸ˜…

DTO Pattern: Prevents mass assignment attacks where a clever client could send an ID in the request body and overwrite someone else's data.

Log Injection Prevention: User input is sanitized before logging. Without this, someone could inject fake log entries by hiding newline characters in their request. Yeah, people actually do that.

PATH Hijacking Prevention: System commands use absolute paths instead of relying on the PATH variable. Another one I learned the hard way via SonarCloud.

Environment Variables: No secrets hardcoded anywhere. MongoDB URI and Redis URL live in environment variables, consistent with how secrets are managed in production environments.


βš™οΈ CI/CD Pipeline

Every push to main triggers the full pipeline automatically. No manual deploys, no "works on my machine" moments.

Push to main
    β†’ GitHub Actions: build + test + JaCoCo coverage report
    β†’ SonarCloud: quality and security analysis (All A grades)
    β†’ Railway: automatic deployment via Dockerfile

Same concept as enterprise CI/CD pipelines β€” automated quality gates before anything reaches production. πŸ’ͺ


πŸš€ Running Locally

Prerequisites: Java 21, Docker, MongoDB Atlas account

1. Clone the repository:

git clone https://github.com/Luis-Morenoo/task-manager-api.git
cd task-manager-api

2. Copy the example config and fill in your credentials:

cp src/main/resources/application.yaml.example src/main/resources/application.yaml

3. Run with Gradle:

./gradlew bootRun

4. Or run with Docker:

docker build -t task-manager .
docker run -p 8080:8080 -e MONGODB_URI=your_uri_here task-manager

Swagger UI opens automatically when the service starts. No hunting for the URL.


πŸ§ͺ Testing

Two layers of tests β€” because one layer is not enough and zero layers is how you find out about bugs in production. πŸ˜…

Unit Tests: Mockito mocks out the database entirely. Tests run in milliseconds and verify every service method in isolation using the Arrange-Act-Assert pattern.

Integration Tests: MockMvc fires real HTTP requests through the full stack against a live MongoDB Atlas instance. Includes a security test that proves the API ignores client-provided IDs even when someone tries to sneak one in.

# Run all tests
./gradlew test

# Run with coverage report
./gradlew test jacocoTestReport

πŸ“ Project Structure

src/
β”œβ”€β”€ main/
β”‚   β”œβ”€β”€ java/com/luis/taskmanager/
β”‚   β”‚   β”œβ”€β”€ controller/          # HTTP request handlers
β”‚   β”‚   β”œβ”€β”€ service/             # Business logic + caching
β”‚   β”‚   β”œβ”€β”€ repository/          # MongoDB data access
β”‚   β”‚   β”œβ”€β”€ model/               # Database entity (Task)
β”‚   β”‚   β”œβ”€β”€ dto/                 # Data Transfer Objects (TaskRequest)
β”‚   β”‚   β”œβ”€β”€ OpenApiConfig.java   # Swagger UI configuration
β”‚   β”‚   └── TaskManagerApplication.java
β”‚   └── resources/
β”‚       └── application.yaml.example
└── test/
    └── java/com/luis/taskmanager/
        β”œβ”€β”€ TaskServiceTest.java               # Unit tests
        └── TaskControllerIntegrationTest.java  # Integration tests

πŸ’‘ What I Learned

Working in enterprise Java environments gives you a lot of exposure β€” reading production code, understanding distributed systems, working within established pipelines. But building something completely from scratch is a different challenge entirely.

This project forced me to understand every layer deeply. Writing tests from scratch gave me a new appreciation for automated test suites I had previously just run and hoped for green. πŸ˜„ SonarCloud flagged real security vulnerabilities I wouldn't have caught on my own. Docker finally made the containerization concepts I had seen in production click. And deploying with a CI/CD pipeline I built myself made the whole end-to-end picture come together.

Building something real and owning every decision is one of the best ways to grow as an engineer. πŸ’ͺ


πŸ“„ Full Technical Documentation β€” detailed architecture, security analysis, and testing documentation


πŸ‘€ Author

Luis Moreno
GitHub | LinkedIn

About

Production-ready REST API built with Java Spring Boot, MongoDB, Redis, Docker, and deployed to Railway. Full CI/CD pipeline with GitHub Actions and SonarCloud (All A grades). πŸš€

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors