RedCheck API is the robust backend infrastructure that powers the intelligent task prioritization system. It handles complex data relationships, secure authentication, and the integration with external AI models.
This repository contains the Backend architecture. You can find the React client and User Interface in this link.
This repository focuses on scalable RESTful API design, rigorous security implementation, and the seamless integration of artificial intelligence for background processing.
The API was engineered with a focus on security, performance, and clear domain segregation.
- SmartCheck AI Integration: Asynchronous communication with external LLMs. The backend constructs complex, context-aware prompts based on the user's workload, enforces strict JSON output formats, and processes the AI response for the frontend.
- Robust Authentication: Secure endpoint protection utilizing Spring Security. It features stateless JWT (JSON Web Token) generation, validation, and custom filter chains for authorization.
- Advanced Data Management: Relational mapping utilizing Spring Data JPA. Includes cascading soft-deletes (Trash functionality) and data isolation between users.
- Recurring Routines Engine: Automated logic to calculate and generate future tasks based on custom periodicities (Daily, Weekly, Biweekly, Monthly).
- Internationalization (i18n) Support: Dynamic prompt engineering that adapts the AI output language based on the client's request (
?lang=parameters).
- Core: Java 17, Spring Boot 3.x.
- Security: Spring Security, JWT (JSON Web Tokens).
- Persistence: Spring Data JPA, Hibernate, MySQL 8.0+.
- Build Tool: Maven.
- Java Development Kit (JDK) 17 or higher
- Maven 3.8+
- MySQL Server running locally or via Docker
- Clone the repository:
git clone https://github.com/redcheckapp/redcheck-backend.git cd redcheck-backend - Database and Environment Configuration:
Update your
src/main/resources/application.ymlwith your local credentials and API keys (Use environment variables!).
spring:
application:
name: RedCheck
datasource:
url: ${DB_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
hibernate:
ddl-auto: ${DDL_AUTO:validate}
show-sql: ${SHOW_SQL:false}
properties:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.MySQLDialect
app:
cors:
allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:5173,http://localhost:8080}
jwt:
secret: ${JWT_SECRET}
ai:
engine:
url: ${AI_ENGINE_URL}
springdoc:
api-docs:
enabled: false
swagger-ui:
enabled: false- Build and Run:
mvn clean install mvn spring-boot:run
- The server will start on
http://localhost:8080.
The codebase strictly adheres to the Controller-Service-Repository pattern, ensuring a clean separation of concerns:
-
Controllers: Handle HTTP requests, routing, and response formatting. -
Services: Contain pure business logic and transactional boundaries. -
Repositories: Interface with the MySQL database via Spring Data JPA. -
DTOs (Data Transfer Objects): Prevent data over-fetching and securely map internal entities to external payloads.
graph TD
%% Node Styles
classDef proxy fill:#009639,stroke:#00732c,stroke-width:2px,color:#fff;
classDef backend fill:#6DB33F,stroke:#4a8229,stroke-width:2px,color:#fff;
classDef aiengine fill:#3670A0,stroke:#29567c,stroke-width:2px,color:#fff;
classDef db fill:#00758F,stroke:#005c70,stroke-width:2px,color:#fff;
classDef vector fill:#FF4F00,stroke:#c43c00,stroke-width:2px,color:#fff;
classDef external fill:#8E75B2,stroke:#6e5a8a,stroke-width:2px,color:#fff;
Gateway["API Gateway / Frontend<br>(External Requests)"]:::proxy
Gemini["Google Gemini 2.5 Flash<br>(External LLM API)"]:::external
%% Backend Isolation Network
subgraph DockerNet ["Internal Network: redcheck-net"]
style DockerNet fill:none,stroke:#0984e3,stroke-width:2px
Spring["Core API Container<br>(Java 17 / Spring Boot)"]:::backend
MySQL[("Database Container<br>(MySQL 8.0)")]:::db
%% SmartCheck AI Sub-module
subgraph AIModule ["SmartCheck AI Module"]
style AIModule fill:none,stroke:#3670A0,stroke-width:2px,stroke-dasharray: 5 5
SmartCheck["SmartCheck AI Engine<br>(Python / FastAPI)"]:::aiengine
ChromaDB[("Vector Memory<br>(ChromaDB / SQLite)")]:::vector
end
end
%% Flow
Gateway -. "REST API Calls<br>(/auth, /tasks, /ai)" .-> Spring
Spring == "TCP 3306<br>(Spring Data JPA)" ==> MySQL
Spring -- "POST /api/v1/prioritize<br>(DTO with Tasks & Analytics)" --> SmartCheck
SmartCheck == "Semantic Similarity Search" ==> ChromaDB
SmartCheck -- "RAG Augmented Prompt" --> Gemini
Gemini -. "Strict JSON Schema" .-> SmartCheck
SmartCheck -. "200 OK (Validated Daily Plan)" .-> Spring
This project is licensed under the GNU Affero General Public License v3.0 (AGPLv3).
