r/SpringBoot • • 5h ago

Discussion I built a Spring AI RAG starter: Ask questions about your PDFs, search works with no API key

I put together a small open-source starter for retrieval-augmented generation in Java and wanted to share it.

What it does: upload PDFs, text or Markdown, then ask questions in plain English from a built-in web page or a REST API.

- Spring Boot 4.1, Spring AI 2.0, Postgres with pgvector

- Embeddings run inside the app (all-MiniLM-L6-v2 via ONNX), so search needs no outside AI service or key

- Optional: set AI_CHAT=openai and your OPENAI_API_KEY for written answers that cite sources by number

- Every endpoint is protected by a generated access key

- MIT licensed; runs locally with Docker, or one click on Railway

Code: https://github.com/Morpheous7/Spring-AI-RAG-Starter

Railway template: https://railway.com/deploy/spring-ai-rag-starter

I tested the OpenAI mode end to end today. Happy to hear feedback, especially on chunking and how you'd structure the ask endpoint.

1 Upvotes

0 comments sorted by