All projects

Working

Multi-Tenant RAG Chatbot

A complete product: passwordless auth, per-org isolation, local embeddings, live cost tracking

Java 21Spring Boot 3.5Spring AI 1.1Claude SonnetONNXApache TikaJsoupAngularTypeScript
Multi-Tenant RAG Chatbot - abstract illustration

What it does

Not a tutorial wrapper. A full application with real authentication (magic-link passwordless with rotating JWTs), per-organization database isolation, and a complete admin console. The RAG pipeline ingests documents via Apache Tika and crawls web content via Jsoup, generates embeddings locally using ONNX models (no external embedding API calls), and retrieves relevant chunks using tag-filtered vector search. The chat interface streams responses from Claude via SSE and records token usage for per-org cost reporting.

The multi-tenant design

Each organization gets its own isolated knowledge base. A master routing layer selects the correct database at request time based on the JWT claims. An admin console lets org administrators manage knowledge sources (upload, crawl, delete), manage users and roles, and view usage reports broken down by user and date range. All of this is in an Angular SPA backed by the same Spring Boot API.

Why local embeddings

Running ONNX embeddings locally removes a significant cost from the RAG pipeline. At scale, embedding API calls add up quickly. The tradeoff is model quality - the local model is smaller than commercial embedding APIs - but for most business document retrieval use cases the quality is more than adequate. The architecture makes it straightforward to swap to an API-based embedding model if needed.

The auth design

No passwords. Users receive a one-time magic link via email. On click, the server issues a short-lived access JWT and a longer-lived refresh JWT. The access token is rotated on each refresh. The passwordless approach removes credential management from both the user and the application while keeping the auth flow standard enough that any HTTP client can use it.

Stack

Java 21Spring Boot 3.5Spring AI 1.1Claude SonnetONNXApache TikaJsoupAngularTypeScript

Want something like this built?

This is the kind of system I build for clients. Tell me what you're trying to do, and I'll give you a straight answer on whether AI is the right tool.

Book a 30-minute call