This project is a Spring Boot application integrated with Google's ADK (Agent Development Kit) to generate and manage recipes using AI agent. It includes Swagger UI for API testing.
- Java 17+
- Maven 3.8+
- Internet connection (for downloading dependencies and using GenAI)
- Google Generative AI API Key
- Build with Maven
mvn clean install- Set up environment variables (required for GenAI)
$env:GOOGLE_API_KEY="your_google_api_key"
$env:GOOGLE_GENAI_USE_VERTEXAI="false"export GOOGLE_API_KEY="your_google_api_key"
export GOOGLE_GENAI_USE_VERTEXAI=false- Set up application.properties
Before running the Spring Boot backend, make sure to configure the following in src/main/resources/application.properties:
# JWT secret key used for signing tokens (change this to a strong, random value)
jwt.secret=your_jwt_secret_here
# Frontend origin(s) allowed for CORS (typically your dev server like Vite or React)
frontend.origins=http://localhost:5173📌 Get your API key from AI studio, u might need to create a google cloud account before that
mvn spring-boot:runjava -jar target/java_project_recipe-1.0.0.jar✅ Make sure environment variables are set before running.
Once the app is running, open your browser and go to:
http://localhost:8080/swagger-ui/index.html
You can test:
- Agent-based recipe generation
- Fetching recipe sets
- Querying individual recipes
| Method | Endpoint | Description |
|---|---|---|
| GET | /recpies/set/{recipesId} |
Get all recipes in a set |
| GET | /recpies/set/{recipesId}/title/{title} |
Get a specific recipe by title in a set |
| POST | /agent/run |
Run ADK agent to generate recipes |
src/main/java
├── agents/recipe/ # ADK Agent + Tool
├── com/example/adkagents/
│ ├── controller/ # REST Controllers
│ ├── entity/ # JPA Entities (Recipe, RecipeSet)
│ ├── repository/ # Spring Data JPA Repositories
│ └── service/ # Service layer logic
-
Missing API Key Error
Make sure to export yourGOOGLE_API_KEYcorrectly before starting the app. -
Port already in use
Stop other applications using port8080or updateserver.portinapplication.properties. -
Swagger not showing full routes
Ensure your controller paths are uniquely defined and don't conflict.
For questions, contact [Pei-Cheng-Yu] or open an issue in the repository.
MIT License – feel free to use, modify, and contribute.