|
1 | | -# 🚀 AI Dev Tools for Spring Boot |
| 1 | +# AI Dev Tools for Spring Boot |
2 | 2 |
|
3 | | -A collection of **AI-powered Spring Boot starters** focused on **enhancing developer experience (DX)** during local development and testing. |
| 3 | +`ai-dev-tools` is a multi-module Maven workspace for Spring Boot developer tooling. The modules in this repository focus on local development workflows such as Swagger payload generation, exception capture, and live debugging dashboards. |
4 | 4 |
|
5 | | -This repository contains production-grade tooling ideas that integrate deeply with the Spring ecosystem to help developers: |
6 | | -- Fix APIs faster |
7 | | -- Reduce repetitive work |
8 | | -- Improve development experience during local runs |
| 5 | +## Modules |
9 | 6 |
|
10 | | -> 🎯 **Goal**: Build AI-assisted developer tooling, not end-user applications. |
| 7 | +| Module | Purpose | |
| 8 | +| --- | --- | |
| 9 | +| `ai-swagger-helper-starter` | Injects a Swagger UI plugin that can generate JSON request bodies from OpenAPI schemas. | |
| 10 | +| `ai-exception-insights-starter` | Captures runtime failures, stores recent error events, and asks a Spring AI chat model for a short diagnosis. | |
| 11 | +| `dev-tools-ui` | Reusable SSE dashboard module used by the exception starter for browser-based output. | |
| 12 | +| `demo-app` | Sample application that wires the starters together and exposes endpoints to try them. | |
11 | 13 |
|
12 | | ---- |
| 14 | +Each module has its own README with module-specific setup and usage details. |
13 | 15 |
|
14 | | -## 📦 Repository Structure |
| 16 | +## Stack |
15 | 17 |
|
16 | | -This is a **multi-module Maven project** with a shared parent POM. |
17 | | -``` |
18 | | -ai-dev-tools |
19 | | -├── .github/workflows |
20 | | -├── LICENCE |
21 | | -├── pom.xml # Parent POM |
22 | | -├── ai-swagger-helper-starter # Swagger/OpenAPI DX tools |
23 | | -├── demo-app # Usage example for all starters |
24 | | -└── README.md |
25 | | -``` |
26 | | - |
27 | | - |
28 | | -Each module: |
29 | | -- Is a **Spring Boot starter** |
30 | | -- Is independently usable |
31 | | -- Focuses on a specific developer pain point |
32 | | - |
33 | | ---- |
34 | | - |
35 | | -## 🧠 Why AI + Spring Boot Starters? |
36 | | - |
37 | | -Traditional developer tools provide **raw data** (logs, specs, stack traces). |
38 | | -These starters use AI to convert that data into **actionable insights**. |
39 | | - |
40 | | -Examples: |
41 | | -- Explaining *why* an API change is breaking |
42 | | -- Generating realistic request payloads from OpenAPI |
43 | | -- Summarizing errors instead of dumping stack traces |
44 | | -- Reducing cognitive load during development |
45 | | - |
46 | | -AI is used **only where reasoning or summarization adds value**, not as a gimmick. |
| 18 | +- Java 21 |
| 19 | +- Spring Boot 4.0.2 |
| 20 | +- Spring AI 2.0.0-M2 |
| 21 | +- Maven multi-module build |
| 22 | +- `springdoc-openapi` for Swagger UI integration |
47 | 23 |
|
48 | | ---- |
| 24 | +## Prerequisites |
49 | 25 |
|
50 | | -## 🧩 Available Starters |
| 26 | +- JDK 21 |
| 27 | +- Maven 3.9+ or the included wrapper |
| 28 | +- An OpenAI-compatible API key if you want live AI responses |
51 | 29 |
|
52 | | -### 1️⃣ AI Swagger Helper Starter |
53 | | -📁 `ai-swagger-helper-starter` |
| 30 | +The repository already includes sample configuration for an OpenAI-compatible endpoint through Spring AI. The demo app uses OpenRouter through the OpenAI adapter. |
54 | 31 |
|
55 | | -Enhancements for Swagger / OpenAPI during development. |
| 32 | +## Build |
56 | 33 |
|
57 | | -**Features** |
58 | | -- Adds a Swagger UI extension |
59 | | -- Generates realistic, real-world request bodies |
60 | | -- Helps developers test APIs faster without manually crafting payloads |
| 34 | +Unix-like shells: |
61 | 35 |
|
62 | | -**Use case** |
63 | | -- Local development |
64 | | -- API testing |
65 | | - |
66 | | ---- |
67 | | - |
68 | | -## 🛠 Planned / In-Progress Starters |
69 | | - |
70 | | -- **AI Exception Explainer Starter** |
71 | | - Converts Spring stack traces into human-readable explanations. |
72 | | - |
73 | | -- **AI Exception Handler** |
| 36 | +```bash |
| 37 | +./mvnw test |
| 38 | +``` |
74 | 39 |
|
75 | | -(Each starter will live in its own module with independent documentation.)* |
| 40 | +Windows PowerShell: |
76 | 41 |
|
77 | | ---- |
| 42 | +```powershell |
| 43 | +.\mvnw.cmd test |
| 44 | +``` |
78 | 45 |
|
| 46 | +## Run the Demo App |
79 | 47 |
|
80 | | -## 🧰 Tech Stack |
| 48 | +Set an API key first if you want AI-backed generation and exception analysis: |
81 | 49 |
|
82 | | -- Java 21+ |
83 | | -- Spring Boot 4 |
84 | | -- Spring Auto-Configuration |
85 | | -- OpenAPI / Swagger |
86 | | -- Maven (multi-module) |
87 | | -- OpenRouter LLM integration (pluggable) |
| 50 | +```powershell |
| 51 | +$env:API_KEY="your-api-key" |
| 52 | +.\mvnw.cmd -pl demo-app -am spring-boot:run |
| 53 | +``` |
88 | 54 |
|
89 | | ---- |
| 55 | +Useful URLs after startup: |
| 56 | + |
| 57 | +- Dashboard: `http://localhost:8081/` |
| 58 | +- Swagger UI: `http://localhost:8081/swagger-ui/index.html` |
| 59 | +- Exception event API: `http://localhost:8081/exception-insights/events` |
| 60 | + |
| 61 | +Demo endpoints: |
| 62 | + |
| 63 | +- `POST /test/generate` for Swagger request-body generation |
| 64 | +- `GET /boom/http` for HTTP exception capture |
| 65 | +- `GET /boom/async` for `@Async` exception capture |
| 66 | +- `GET /boom/thread` for uncaught thread exception capture |
| 67 | +- `GET /boom/event` for an event-listener failure triggered from an HTTP request |
| 68 | + |
| 69 | +## Configuration Example |
| 70 | + |
| 71 | +```yaml |
| 72 | +spring: |
| 73 | + ai: |
| 74 | + openai: |
| 75 | + api-key: ${API_KEY} |
| 76 | + chat: |
| 77 | + base-url: https://openrouter.ai/api |
| 78 | + options: |
| 79 | + model: inclusionai/ling-2.6-1t:free |
| 80 | + |
| 81 | +devtools: |
| 82 | + ai: |
| 83 | + swagger-helper: |
| 84 | + enabled: true |
| 85 | + mode: ai |
| 86 | + exception-insights: |
| 87 | + enabled: true |
| 88 | + output: ui |
| 89 | +``` |
90 | 90 |
|
91 | | -## 📌 Who Is This For? |
| 91 | +## Notes |
92 | 92 |
|
93 | | -- Backend developers working with Spring Boot |
94 | | -- Engineers interested in platform / tooling work |
95 | | -- Developers exploring AI-assisted development workflows |
| 93 | +- `ai-swagger-helper-starter` supports `AUTO`, `AI`, and `RANDOM` modes. |
| 94 | +- `ai-exception-insights-starter` stores events in memory only and can output to the console or the browser UI. |
| 95 | +- `dev-tools-ui` is reusable, but the shipped dashboard is currently tailored to the exception starter's REST and SSE contract. |
0 commit comments