This repository contains the Spring Boot backend developed for the RoastMyRoadMap event organized by the IoT Lab at Innovance 3.0. The application integrates Redis and OpenAI's API to generate personalized roast messages based on user choices, with Redis utilized for load balancing to optimize API usage and reduce costs.
- Personalized Roast Generation: Utilizes OpenAI's API to create roast messages tailored to user inputs.
- Caching and Load Balancing with Redis: Implements Redis for efficient caching and load balancing, minimizing API costs.
- RESTful API: Provides endpoints for user interactions and roast generation.
The application follows a layered architecture:
- Controller Layer: Handles HTTP requests and responses.
- Service Layer: Contains business logic for processing user inputs and generating roasts.
- Repository Layer: Manages data persistence and retrieval, utilizing Redis for caching and load balancing.
Before running the application, ensure you have the following installed:
- Java Development Kit (JDK) 11 or higher: Download JDK
- Gradle: Download Gradle
- Redis Server: Download Redis
-
Clone the repository:
git clone https://github.com/iot-lab-kiit/Innovance-App.git
-
Navigate to the project directory:
cd Innovance-App
-
Build the application using Gradle:
./gradlew build
- Redis Configuration:
-
Ensure the Redis server is running on localhost with the default port 6379. If it's running on a different host or port, update the application.properties file accordingly:
spring.redis.host=localhost spring.redis.port=6379
- OpenAI API Key:
-
Obtain your OpenAI API key from the OpenAI Dashboard.
-
Set the API key in the application.properties file:
openai.api.key=YOUR_OPENAI_API_KEY
- Start the Redis Server:
- Ensure that the Redis server is up and running.
-
Run the Spring Boot Application:
./gradlew bootRun
-
Access the API:
- The application will be accessible at http://localhost:8080.
- Use tools like Postman or
curl
to interact with the API endpoints.
Contributions are welcome! Please fork the repository and create a pull request with your changes. Ensure that your code adheres to the project's coding standards and includes appropriate tests.