I Built a Self-Hosted AI Support Widget with Spring Boot (No Monthly SaaS Fees)

작성자

카테고리:

← 피드로
DEV Community · Swarna · 2026-08-08 개발(SW)
Cover image for I Built a Self-Hosted AI Support Widget with Spring Boot (No Monthly SaaS Fees)

Swarna

Every new SaaS seems to embed ChatGPT these days.

Most AI support solutions rely on third-party platforms, monthly subscriptions, and vendor lock-in. While they’re great products, I wanted something different.

I wanted complete ownership.

I wanted to deploy everything on my own server, use my own OpenAI API key, customize every part of the experience, and embed the widget into any website with a single script tag.

So I built my own self-hosted AI support widget using Spring Boot and Vanilla JavaScript.

Why I Built It

When building small products and websites, I realized that customer support quickly becomes a problem.

Users have questions about pricing, features, returns, or simply get stuck.

Most developers solve this by integrating services like Intercom, Crisp, or Tidio.

Those platforms are excellent, but they also mean:

Monthly subscription costs
Vendor lock-in
Customer conversations stored on third-party platforms
Limited customization
Another external dependency

I wanted something that developers could completely own.

The Goal

The goal was simple.

Build an AI-powered customer support widget that developers can deploy on their own server and integrate into any website in less than a minute.

The widget should:

Answer customer questions using AI
Learn from a custom knowledge base
Match the company’s branding
Store conversation history
Allow human handoff
Be easy to deploy
Require only one script tag to embed

Technology Stack
Java 17
Spring Boot 3
Spring Security
Spring Data JPA
Thymeleaf
Vanilla JavaScript
H2 Database (MySQL supported)
OpenAI API

Architecture

The overall architecture is intentionally simple.
Visitor


AI Chat Widget
(Vanilla JavaScript)


Spring Boot REST API


OpenAI API


Database
(H2 / MySQL)
Keeping the frontend framework-free makes the widget lightweight and easy to embed into virtually any website.

One-Line Integration

Adding the widget to a website only requires a single script.
<script src="/widget/widget.js" data-api-base=""></script>
No React.

No Vue.

No npm packages.

Just one script.

Features I Built

The project includes:

✅ AI-powered customer support

✅ Spring Boot backend

✅ Secure admin authentication

✅ Custom knowledge base

✅ Conversation history

✅ Brand customization

✅ Human handoff with email notification

✅ OpenAI API configuration

✅ H2 support with MySQL production configuration

✅ One-line website integration

The Admin Dashboard

Instead of hardcoding prompts inside the application, administrators can configure everything from the dashboard.

They can update:

Company name
Greeting message
Brand color
OpenAI API key
Knowledge base
Notification email

Changes take effect immediately without restarting the application.

Why I Didn’t Use RAG

One interesting design decision was intentionally not implementing Retrieval-Augmented Generation (RAG).

Instead, administrators maintain a simple knowledge base that is included in the AI’s system prompt.

For small and medium-sized businesses, this approach keeps deployment extremely simple while still delivering accurate responses.

If the project grows, adding vector search later is straightforward.

Sometimes simplicity is the better engineering decision.

Human Handoff

AI can’t answer everything.

Whenever visitors need human assistance, they can submit their email.

The system:

Stores the lead in the database
Sends an email notification (if SMTP is configured)
Lets administrators continue the conversation manually

This ensures users never hit a dead end.

Lessons Learned

Building the OpenAI integration wasn’t actually the hardest part.

The real engineering challenges were:

Designing a flexible architecture
Authentication and authorization
Conversation persistence
Prompt management
Making the widget framework-independent
Creating an admin experience that non-developers can use

Those pieces ended up being much more interesting than simply calling an AI API.

Things I Intentionally Left Out

Every project needs boundaries.

I intentionally skipped:

Multi-tenancy
Stripe subscriptions
Vector databases
Multiple AI providers
Complex AI orchestration

The goal was to build a clean, understandable codebase that developers can deploy quickly and extend however they like.

What’s Next?

I’m considering adding:

Streaming AI responses
Multiple AI providers
RAG support
File uploads
Conversation analytics
Multi-tenant architecture

Final Thoughts

This project reminded me that building AI products isn’t just about connecting to an LLM.

The real engineering happens around it:

authentication
configuration
deployment
usability
persistence
developer experience

Those are the parts that transform an API call into a real product.

I’d love to hear how you’re building AI applications with Java or Spring Boot, and what features you would add to a self-hosted support widget.

Interested in the Full Project?

I built this as a complete, production-ready Spring Boot project. If you’d like the full source code, setup guide, and deployment instructions, you can find it here:

👉(https://swarnalata25.gumroad.com/l/supportai-springboot)

I’m also building more self-hosted Java & Spring Boot products, so feedback and suggestions are always welcome.

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다