A robust, feature-rich backend application designed for personalized task management, integrating advanced filtering, dynamic notifications (Kafka/SMTP), time tracking, and experimental AI-powered natural language querying.
| Status | Details |
|---|---|
| Language | |
| Framework | |
| Database | |
| Messaging | |
| Security | |
| Documentation |
TaskPilot is a high-performance backend system built on Spring Boot 3.x, focused on providing secure, scalable, and auditable task management capabilities. The core problem solved is managing complex user workflows—tasks with sub-checklists, detailed time estimation, and mandatory time tracking—all while ensuring data isolation and providing versatile communication channels.
The project features decoupled asynchronous/synchronous notification mechanisms and implements advanced querying using the JPA Specification pattern. A notable feature is the secure integration with Google Gemini, allowing users to query their private task data using natural language, safeguarded by row-level security enforcement.
The following features are derived directly from the application's controllers and services:
- User Authentication & Security: Implements JWT token generation, validation, and authorization using Spring Security, securing all task endpoints. Passwords are secured using
BCryptPasswordEncoder. - Comprehensive Task Management: Supports CRUD operations for tasks, tracking task attributes such as
TaskPriorityandTaskStatus(e.g., NOT_STARTED, INPROGRESS, COMPLETED). - Dynamic Task Filtering (JPA Specification): Offers a single unified endpoint for complex querying, supporting combination filters across multiple fields including task name, status, priority, category details, keyword searching, and creation date ranges.
- Time Tracking and Auditing:
- Uses JPA Auditing (
Basemodel) to automatically populatecreatedAtandupdatedAttimestamps. - Allows users to log task start/completion times (
startDateTime,endDateTime). - Calculates
totalTimeTakenand provides a comparison remark against theexpectedTaskTime.
- Uses JPA Auditing (
- Checklist Management: Supports creating, retrieving, deleting, starting, and completing associated
ChecklistItemsubtasks for any main task.- Constraint Enforcement: Logic prevents users from marking a main task complete if associated checklist items are still pending.
- Time Validation: Enforces that the total estimated time of all checklist items does not exceed the estimated time of the parent task (
ChecklistTimeExceedsException).
- Configurable Notification System: Uses a Strategy Pattern via
UnifiedNotificationDispatcher. The system can be toggled by theuse.kafkaproperty to operate in two modes:- Asynchronous (Kafka): Dispatches email requests to a Kafka topic for processing by an
EmailKafkaConsumer. - Synchronous (Direct): Immediately sends emails using either the configured SendGrid API or SMTP server (switchable via
email.provider).
- Asynchronous (Kafka): Dispatches email requests to a Kafka topic for processing by an
- Scheduled Reminders: A daily scheduler (
ReminderScheduler) fetches all users and their pending tasks (TaskStatus.COMPLETEDexcluded) and dispatches daily reminder emails via the unified notification system. - AI Data Integration (Secure NL-to-SQL): The
ChatbotIntegrationControllerallows users to submit natural language prompts which are converted to runnable SQL queries via the Gemini API. The integration ensures data security by forcing the AI to includeWHERE user_id = %din all generated queries, limiting data access to the authenticated user.
| Category | Technology | Version | Source Evidence |
|---|---|---|---|
| Backend Framework | Spring Boot | 3.4.5 (Parent) | pom.xml |
| Language | Java | 17 | pom.xml |
| Persistence | Spring Data JPA, Hibernate | N/A | pom.xml |
| Database | MySQL | N/A | pom.xml, application.properties |
| Messaging | Spring Kafka | N/A | pom.xml |
| Security | Spring Security, JJWT | 0.11.5 | pom.xml |
| External Services | Google Gemini (AI) | 1.0.0 | pom.xml, GeminiIntegrationService |
| Email Providers | SendGrid, JavaMailSender (SMTP) | 4.10.3 (SendGrid) | pom.xml, application.properties |
| Documentation | Springdoc OpenAPI UI | 1.7.0 | pom.xml |
| Utilities | Lombok, Validation | N/A | pom.xml, jakarta.validation imports |
TaskPilot employs a layered service architecture utilizing Spring framework components heavily for decoupling and advanced functionality.
- Auditing and Soft Deletes: All entities (User, Task, Category, etc.) inherit from
Basemodel, which utilizes@EntityListeners(AuditingEntityListener.class)to automate the tracking ofcreatedAtandupdatedAt, and includes aisDeletedflag for optional soft deletion. - Pluggable Notifications (Strategy Pattern): The
UnifiedNotificationDispatcheracts as a facade, deciding whether to use the Kafka producer (NotificationDispatcher) or direct email sender (DirectNotificationDispatcher) based on the runtime propertyuse.kafka. This allows the application to switch seamlessly between asynchronous and synchronous communication based on deployment needs. - Secure AI Layer: The
GeminiIntegrationServiceuses a pre-cached schema (SchemaCache) to structure its prompts, guaranteeing that the AI generates valid, production-ready SQL. Security is hardcoded by injecting the authenticated user's ID (userId) into the LLM prompt to ensure all generated queries contain a mandatoryWHERE user_id = %dclause.
To run this application, you must have the following installed:
- Java Development Kit (JDK): Version 17 or higher.
- Maven: For dependency management and building (
pom.xmlpresent). - MySQL Database: The application is configured to connect to an external MySQL instance.
- Kafka (Optional): If
use.kafka=true, a local Kafka broker must be running onlocalhost:9092.
git clone <repository_url>
cd TaskPilot_TaskManagerYou must set the following critical environment variables or replace the placeholders in application.properties (or your preferred environment manager):
| Variable | Purpose | Source |
|---|---|---|
JWT_SECRET |
Secret key for JWT token signing. | application.properties |
GEMINI_API_KEY |
API Key for accessing Google Gemini services. | application.properties |
AWS_MYSQL_RDS_DB_PASS |
Password for MySQL Database access. | application.properties |
SPRINGMAIL_GMAIL_APP_USER |
Gmail username (if email.provider=smtp). |
application.properties |
SPRINGMAIL_GMAIL_APP_PASS |
Gmail app password (if email.provider=smtp). |
application.properties |
SENDGRID_API_KEY |
SendGrid API Key (if email.provider=sendgrid). |
application.properties |
sendgrid.from.email |
Sender email address. | application.properties |
Configuration Toggle (application.properties):
The application default configuration uses direct email dispatch (SMTP). If you wish to use Kafka, update these properties:
# To enable Kafka queue dispatch, mark it as true:
use.kafka=true
# choose email provider irrespective of use.kafka value, choose out of sendgrid and smtp (note: both require additional setup of access keys such as sendgrid api key or gmail app password):
email.provider=smtp
# Spring Kafka bootstrap servers configured below (default: localhost:9092)- Build the Project:
mvn clean install
- Run the Application:
mvn spring-boot:run
The application will start on the default Spring Boot port (typically 8080).
All endpoints, except those under /auth, require a JWT Bearer token.
| Endpoint | Method | Purpose |
|---|---|---|
/auth/signup |
POST |
Registers a new user. |
/auth/login |
POST |
Authenticates user (by username or email) and returns a JWT in the Authorization Header. |
Once authenticated, include the JWT in the Authorization: Bearer <token> header for all subsequent API calls.
The following core functional routes are available:
| Endpoint | Method | Purpose | Details |
|---|---|---|---|
/tasks |
POST |
Create a new task. | Requires Task name, category code, priority, and expected time estimate. |
/tasks/{taskId} |
PATCH |
Update existing task details. | Allows updating name, description, priority, category code, and expected time. |
/tasks |
GET |
Advanced Filtering/Search. | Uses the JPA Specification pattern for combined filtering, sorting, pagination, and keyword search. |
/tasks/{taskId} |
DELETE |
Delete a task. | Triggers email notification upon successful deletion. |
/tasks/{taskId}/log-start |
PATCH |
Log task starting time. | Sets startDateTime and changes taskStatus to INPROGRESS. |
/tasks/{taskId}/mark-task-complete |
PATCH |
Mark task complete. | Sets taskStatus to COMPLETED, marks all associated checklist items as complete, and calculates total time taken. |
| Endpoint | Method | Purpose |
|---|---|---|
/task/{taskId}/checklist-items |
POST |
Create one or more checklist items for the given task. |
/task/{taskId}/checklist-items/{checklistId} |
GET |
Retrieve a single checklist item. |
/task/{taskId}/checklist-items/{checklistId}/start |
PATCH |
Log start of a checklist item. |
/task/{taskId}/checklist-items/{checklistId}/mark-checklist-item-complete |
PATCH |
Mark a checklist item as complete. |
/task/{taskId}/checklist-items/{checklistId} |
DELETE |
Delete a checklist item. |
| Endpoint | Method | Purpose |
|---|---|---|
/category |
POST |
Create a custom task category. |
/category |
GET |
Retrieve all categories belonging to the user. |
/category/{id} |
PATCH |
Update category details. |
/category/{id} |
DELETE |
Delete a category. |
| Endpoint | Method | Purpose |
|---|---|---|
/api/chatbot/query |
POST |
Submit a natural language prompt to query task data. |