Case Study: Adding an AI Chat to My Portfolio

October 17, 2026 (3d ago)

The problem

A recruiter skimming a portfolio has specific questions: Have you used Kafka? How long with Spring Security? Open to relocation? A static page makes them hunt for the answer, or leave. I wanted visitors to be able to just ask.

Constraints

Architecture

Browser (chat-widget.js)  ──POST {question}──▶  AWS Lambda Function URL
                          ◀──{answer}─────────  retrieve resume context → LLM

Frontend: one script, ~75 lines

public/chat-widget.js is plain JavaScript. It injects its own styles and markup, reads the endpoint from a data-endpoint attribute, and talks to the backend with a single fetch:

const r = await fetch(endpoint, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ question }),
});

In Next.js it is loaded once from the root layout with next/script and strategy="afterInteractive", so it never blocks the first paint.

Key decisions:

Backend: Lambda Function URL

The backend is a single AWS Lambda exposed through a Function URL (no API Gateway). It retrieves the most relevant parts of my resume and project notes for the question and passes them to an LLM, so answers stay grounded in real experience.

Results

Try it yourself: click the 💬 button in the bottom-right corner of any page.

What I'd do next