Skip to content

the-dimensionless/insightflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ LLM Feedback Processor

A real-time feedback processing system that uses AI to analyze user feedback and provides instant insights through sentiment analysis, categorization, and summarization.

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚    Backend      β”‚    β”‚  Infrastructure β”‚
β”‚   (React)       β”‚    β”‚  (Spring Boot)  β”‚    β”‚   (Docker)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β”‚                       β”‚                       β”‚
         β–Ό                       β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   User Input    β”‚    β”‚   API Gateway   β”‚    β”‚   Kafka + Redis β”‚
β”‚   Dashboard     β”‚    β”‚   WebSocket     β”‚    β”‚   OpenAI API    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”„ How It Works

  1. User submits feedback through the React dashboard
  2. Backend receives the feedback via REST API
  3. Kafka processes the message asynchronously
  4. OpenAI analyzes the feedback using GPT-3.5-turbo
  5. Redis stores the enriched data
  6. WebSocket pushes real-time updates to the frontend
  7. Dashboard updates automatically with AI insights

🎯 Key Features

  • βœ… Real-time Processing - Instant feedback analysis
  • βœ… AI Enrichment - Sentiment, category, and summary generation
  • βœ… Scalable Architecture - Kafka message queuing + Redis caching
  • βœ… Live Updates - WebSocket push notifications
  • βœ… Docker Ready - Easy deployment and scaling
  • βœ… Monitoring - Health checks and metrics

πŸ› οΈ Technology Stack

Backend

  • Framework: Spring Boot 3.2.0
  • Language: Java 17
  • Build Tool: Maven
  • Message Queue: Apache Kafka
  • Cache: Redis
  • Real-time: WebSocket
  • AI: OpenAI GPT-3.5-turbo

Frontend

  • Framework: React 18.2.0
  • HTTP Client: Axios
  • WebSocket: SockJS + StompJS
  • Routing: React Router

Infrastructure

  • Containerization: Docker + Docker Compose
  • CI/CD: GitHub Actions

πŸš€ Quick Start

Prerequisites

  • Java 17
  • Node.js 16+
  • Docker & Docker Compose
  • OpenAI API Key

1. Clone the Repository

git clone <repository-url>
cd insightflow

2. Set Environment Variables

# Create .env file
echo "OPENAI_API_KEY=your-openai-api-key" > .env

3. Start Infrastructure

docker-compose up -d

4. Start Backend

cd backend
./mvnw spring-boot:run

5. Start Frontend

cd frontend
npm install
npm start

6. Access the Application

πŸ“Š API Endpoints

Submit Feedback

POST /api/feedback
Content-Type: application/json

{
  "userId": "user123",
  "message": "I love the new dashboard!"
}

Health Check

GET /api/health

WebSocket Connection

ws://localhost:8080/ws-feedback
Topic: /topic/feedback

πŸ”§ Configuration

Environment Variables

# OpenAI Configuration
OPENAI_API_KEY=your-openai-api-key

# Kafka Configuration
SPRING_KAFKA_BOOTSTRAP_SERVERS=localhost:9092

# Redis Configuration
SPRING_REDIS_HOST=localhost
SPRING_REDIS_PORT=6379

# Application Configuration
SERVER_PORT=8080

Docker Services

  • Kafka: localhost:9092
  • Redis: localhost:6379
  • Zookeeper: localhost:2181

πŸ“ˆ Data Flow Example

Input Feedback

{
  "userId": "user123",
  "message": "The new dashboard is amazing! Much better than before.",
  "timestamp": 1718900000
}

AI Enrichment Output

{
  "userId": "user123",
  "message": "The new dashboard is amazing! Much better than before.",
  "timestamp": 1718900000,
  "sentiment": "positive",
  "category": "praise",
  "summary": "User is very satisfied with the new dashboard improvements"
}

πŸ›οΈ Project Structure

insightflow/
β”œβ”€β”€ backend/                 # Spring Boot Application
β”‚   β”œβ”€β”€ src/main/java/
β”‚   β”‚   └── com/insightflow/
β”‚   β”‚       β”œβ”€β”€ controller/  # REST Controllers
β”‚   β”‚       β”œβ”€β”€ service/     # Business Logic
β”‚   β”‚       β”œβ”€β”€ config/      # Configuration
β”‚   β”‚       β”œβ”€β”€ model/       # Data Models
β”‚   β”‚       └── consumer/    # Kafka Consumers
β”‚   β”œβ”€β”€ pom.xml
β”‚   └── Dockerfile
β”œβ”€β”€ frontend/                # React Application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React Components
β”‚   β”‚   β”œβ”€β”€ services/        # API Services
β”‚   β”‚   └── utils/           # Utilities
β”‚   β”œβ”€β”€ package.json
β”‚   └── Dockerfile
β”œβ”€β”€ docs/                    # Documentation
β”‚   β”œβ”€β”€ system-flow.md       # Detailed system flow
β”‚   β”œβ”€β”€ architecture-diagram.md # Mermaid diagrams
β”‚   └── quick-reference.md   # Quick reference guide
β”œβ”€β”€ docker-compose.yml       # Infrastructure setup
└── README.md               # This file

πŸ” Monitoring & Health Checks

Spring Boot Actuator

Docker Health Checks

# Check container status
docker-compose ps

# View logs
docker-compose logs -f kafka
docker-compose logs -f redis

🚨 Troubleshooting

Common Issues

  1. Java Version Mismatch

    # Check Java version
    java -version
    
    # Should show Java 17
  2. Maven Build Issues

    cd backend
    ./mvnw clean install
  3. Docker Issues

    # Restart containers
    docker-compose down
    docker-compose up -d
  4. OpenAI API Issues

    • Verify API key is valid
    • Check API quota and limits
    • Ensure network connectivity

Logs

# Backend logs
./mvnw spring-boot:run

# Docker logs
docker-compose logs -f

# Frontend logs
npm start

πŸ§ͺ Testing

Backend Testing

cd backend
./mvnw test

API Testing

# Test feedback submission
curl -X POST http://localhost:8080/api/feedback \
  -H "Content-Type: application/json" \
  -d '{"userId":"test","message":"Great app!"}'

# Test health check
curl http://localhost:8080/api/health

πŸ“š Documentation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

For support and questions:

  • Create an issue in the repository
  • Check the troubleshooting section
  • Review the documentation

Built with ❀️ using Spring Boot, React, Kafka, Redis, and OpenAI

About

llm-feedback-processor | real-time-feedback-stream

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors