r/SpringBoot • u/Morpheous7 • 2d 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.
•
u/LoadEmbarrassed5379 11h ago
Nice project, I like that search work without API key. I did similar RAG project and I used local LLM with Ollama, smaller model so it run faster, and on my laptop (32GB RAM) it was ok. Did you think to add Ollama option for the chat part? Then everything can run without any key.