This directory contains all backend microservices for the Task Management application.
backend/
├── task-service/ # Main task management API
└── notification-service/ # Event consumer & notification handler
The main REST API service that handles:
- Task CRUD operations
- File attachment management
- Event publishing to Kafka
- Database interactions
Technology Stack:
- Spring Boot 3.2
- Spring Data JPA
- PostgreSQL 16
- Apache Kafka
- MinIO Client
- Logstash Logback Encoder
Event-driven microservice that:
- Consumes Kafka events
- Processes task notifications
- Logs all task-related events
- (Future: Email/SMS notifications)
Technology Stack:
- Spring Boot 3.2
- Spring Kafka
- Logstash Logback Encoder
- Java 17 or higher
- Maven 3.9+
- Docker (for infrastructure services)
cd devops/docker
docker compose up -dcd backend/task-service
# Clean build
./mvnw clean install
# Run the application
./mvnw spring-boot:run
# Or with dev profile
./mvnw spring-boot:run -Dspring-boot.run.profiles=devAccess: http://localhost:8080
cd backend/notification-service
# Clean build
./mvnw clean install
# Run the application
./mvnw spring-boot:runAccess: http://localhost:8081
Location: task-service/src/main/resources/application.yml
Key configurations:
server:
port: 8080
spring:
datasource:
url: jdbc:postgresql://localhost:5432/taskdb
username: taskuser
password: taskpass
kafka:
bootstrap-servers: localhost:9092
minio:
url: http://localhost:9000
access-key: minioadmin
secret-key: minioadmin
bucket: task-attachmentsLocation: notification-service/src/main/resources/application.yml
Key configurations:
server:
port: 8081
spring:
kafka:
bootstrap-servers: localhost:9092
consumer:
group-id: notification-service-groupCREATE TABLE tasks (
id BIGSERIAL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description VARCHAR(1000),
status VARCHAR(50) NOT NULL DEFAULT 'TODO',
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP
);CREATE TABLE task_attachments (
id BIGSERIAL PRIMARY KEY,
task_id BIGINT NOT NULL,
file_name VARCHAR(255) NOT NULL,
original_file_name VARCHAR(255) NOT NULL,
content_type VARCHAR(100),
file_size BIGINT,
uploaded_at TIMESTAMP NOT NULL,
FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE
);Purpose: Publishes all task-related events
Event Types:
CREATED- When a task is createdUPDATED- When a task is updatedDELETED- When a task is deleted
Event Schema:
{
"taskId": 1,
"title": "Task title",
"description": "Task description",
"status": "TODO",
"eventType": "CREATED",
"timestamp": "2026-01-17T12:00:00"
}# Task Service
cd backend/task-service
./mvnw test
# Notification Service
cd backend/notification-service
./mvnw test# Health check
curl http://localhost:8080/actuator/health
# Get all tasks
curl http://localhost:8080/api/tasks
# Create a task
curl -X POST http://localhost:8080/api/tasks \
-H "Content-Type: application/json" \
-d '{
"title": "Test Task",
"description": "Testing API",
"status": "TODO"
}'
# Get task by ID
curl http://localhost:8080/api/tasks/1
# Update task
curl -X PUT http://localhost:8080/api/tasks/1 \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Task",
"description": "Updated description",
"status": "IN_PROGRESS"
}'
# Delete task
curl -X DELETE http://localhost:8080/api/tasks/1
# Upload file
curl -X POST http://localhost:8080/api/tasks/1/attachments \
-F "file=@/path/to/file.pdf"
# Get attachments
curl http://localhost:8080/api/tasks/1/attachmentsBoth services send logs to ELK Stack via Logstash.
Log Levels:
DEBUG- Application-specific logsINFO- General informationWARN- Warning messagesERROR- Error messages with stack traces
View logs in Kibana:
- URL: http://localhost:5601
- Index:
application-logs-* - Filter by service:
service: "task-service"
Local log files:
- Task Service:
backend/task-service/logs/task-service.log - Notification Service:
backend/notification-service/logs/notification-service.log
Planned security features:
- JWT authentication
- Role-based access control (RBAC)
- API rate limiting (via Kong)
- Input validation
- SQL injection prevention
- XSS protection
# Find process using port 8080
lsof -i :8080
# Kill the process
kill -9 <PID># Check if PostgreSQL is running
docker ps | grep postgres
# Check database connection
docker exec -it task-postgres psql -U taskuser -d taskdb
# Restart PostgreSQL
cd devops/docker
docker compose restart postgres# Check Kafka status
docker ps | grep kafka
# Check Kafka logs
docker logs task-kafka
# Restart Kafka
cd devops/docker
docker compose restart kafka# Clean Maven cache
rm -rf ~/.m2/repository/com/learning/
# Clean project
./mvnw clean
# Rebuild
./mvnw clean install -U# Build JAR file
./mvnw clean package -DskipTests
# JAR location
ls -lh target/*.jar
# Run JAR
java -jar target/task-service-0.0.1-SNAPSHOT.jar# Task Service
cd backend/task-service
docker build -t task-service:latest -f ../../devops/docker/dockerfiles/task-service.Dockerfile .
# Notification Service
cd backend/notification-service
docker build -t notification-service:latest -f ../../devops/docker/dockerfiles/notification-service.Dockerfile .docker run -d \
--name task-service \
--network taskmanagement_app-network \
-p 8080:8080 \
-e SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/taskdb \
-e SPRING_KAFKA_BOOTSTRAP_SERVERS=kafka:29092 \
task-service:latest- Indexes on frequently queried columns
- Connection pooling (HikariCP)
- Query optimization
- Redis for frequently accessed data
- HTTP caching headers
- CDN for static assets
- Spring Boot Actuator endpoints
- Prometheus metrics (planned)
- Grafana dashboards (planned)
See API Documentation for complete endpoint reference.
- Create a feature branch
- Write tests
- Ensure all tests pass
- Submit a pull request
MIT License - Free to use for learning purposes