Skip to content

Language

EnglishEestiEspañolไทย
Independent product

davthecoder.com site AI assistant

Designed and shipped the Worker API, knowledge and prompt boundaries, React chat island, evaluation golden set, and contact handoff.

A production site assistant for the portfolio, writing, and the upcoming book. Grounding, safety, and no project-enquiry path.

  • Cloudflare Workers
  • TypeScript
  • SSE
  • React
  • AI Assistant
  • Guardrails
  • Astro
davthecoder.com site AI assistant product identity

The problem, my role and the result

Problem
Visitors need clear answers about the portfolio, the writing, and the book without hunting through every page.
Approach
A floating React panel on a static Astro site, backed by a Cloudflare Worker that validates input, rate limits traffic, grounds answers on a curated pack, streams the model, and blocks jailbreaks and off topic turns.
Outcome
A public assistant on the personal site, with tests, browser only history, and limits a reader can inspect.
Stack
Astro, React, Cloudflare Workers, SSE, xAI / SpaceXAI, Vitest

I added a floating assistant to davthecoder.com. It answers questions about the portfolio, the writing, and the book. It does not take project enquiries.

It is not a general purpose bot and it is not a third party widget. It is a product on this site: public traffic, a hard knowledge boundary, streaming UI, and cost and abuse controls. Writing about the other shipped assistants is on AI engineering.

Problem

Most personal sites leave people hunting through pages or staring at an empty form. Dropping in a generic LLM would invent rates, clients, and random courses. That would hurt the brand and teach nothing about how I build AI in products.

I needed three things:

  1. Useful answers about the portfolio, the writing, and the book
  2. A public setup that keeps the API key off the browser (CORS, rate limits, validation)
  3. Portfolio proof of applied AI without claiming ML research or inventing client AI work

Architecture

Browser (Astro static site + React ChatWidget)
    │  POST /v1/chat + SSE
    ▼
Cloudflare Worker (workers/site-chat)
    validate → rate limit → input guardrails
    → system prompt + curated knowledge pack
    → LLM stream → strip handoff markers → SSE tokens / handoff / done

The static site stays simple. The Worker owns secrets and policy. Conversation history lives in the visitor’s localStorage. There is no server side transcript store in this version. Analytics events (chat_open, chat_send, chat_handoff, feedback) only fire when consent is on.

What visitors get

  • Starter prompts, English and Spanish chrome, streaming replies
  • Markdown with allowlisted links (this site plus my own products)
  • A link to the contact page when someone asks how to write, which is an email address
  • No drafted emails, no public prices, no fake availability calendars
  • Answers stay on the portfolio, the writing, and the book

Safety and cost

These are the controls that keep a public chat from becoming a toy or a liability:

Control Why it is there
Caps on message length, history, and output tokens Bound spend and abuse
Per IP rate limit The endpoint is public
Input guardrails for jailbreaks and hard off topic turns Fail closed before the model runs
Fixed system rules (role, link allowlist, no third party course spam) Keep answers on brand
No personal data collected in chat Privacy

Numbers in the Worker can change. This write up claims the shape of the controls, not vanity metrics I have not measured for the page.

Evaluation

I keep a golden question set next to the Worker (workers/site-chat/eval/golden-set.json). It covers identity, services, AI framing, portfolio, refusing prices, jailbreaks, and a Spanish smoke set. Scoring against the live Worker is how pack gaps show up. When the bot did not know Paglipat, that was a knowledge bug, not something to paper over with a vague answer.

How this sits next to the other AI case studies

Case study What it shows Role
Paglipat Tool calling relocation concierge, model routing, cost ledger, retention Deepest production AI engineering
This page (site chat) Curated site guide plus handoff Live demo on the brand site
ElTarot.es One contained daily AI reading Smaller scope on purpose

All three are products I shipped. The writing is on AI engineering.

Limitations

  • Knowledge is a curated pack, not full retrieval over every blog post yet.
  • This chat does not run multi tool agents. Paglipat was the deep tool calling piece.
  • The assistant answers from the published site. Email is [email protected].
  • Cost and latency only go into copy when I have measured them.

Frequently Asked Questions

Does this chat take project enquiries?

It answers questions about the portfolio, the writing, and the book. Email is on the contact page.

Where is the deeper AI agent work?

Paglipat.

Does this mean you stopped doing Android and KMP?

No. Senior mobile engineering is still the core of the site. Applied AI is a specialist capability with independent portfolio proofs.

Need this kind of work on your app?

Five lines about your app. I reply within 2 working days and say whether it fits.

I used AI to help write and correct these texts, so spelling mistakes and errors may occur. If you find one, please report it: [email protected]