{
  "id": 16170623,
  "title": "HeshBot: a small, self-hosted website chatbot (and three ways to power one)",
  "url": "https://urgent.news/2026/10/23/heshbot-a-small-self-hosted-website-chatbot-and-three-ways-to-power",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-23T09:49:35.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/yardphantom/heshbot-a-small-self-hosted-website-chatbot-and-three-ways-to-power-one-3kip"
  },
  "original_language": "en",
  "account": "HeshBot is a small, self-hosted website chatbot created by Trevor Heshka to replace an earlier Typebot widget. The chatbot is open source under the MIT license and can be found on GitHub. The chatbot has three main components: the widget, the endpoint, and the knowledge source.\n\nThe widget, heshbot.js and heshbot.css, are plain JavaScript and CSS files with no dependencies. It is lightweight, loads only when clicked, and works on both desktop and mobile devices. The bot replies use a small markdown renderer that escapes content and adds a whitelist of tags. The conversation is stored in sessionStorage, which is cleared when the tab is closed.\n\nThe endpoint, api/chat.php, requires PHP 7.4+ and curl to run on ordinary shared hosting. It calls the Google Gemini API over REST and uses a list of free-tier Flash models in order, with per-IP rate limiting and caps on message history and character counts. The chat.php file is the only reachable file in its directory, with a guarded API key stored outside the public folder.\n\nThe bot's knowledge comes from two files, api/system-prompt.md and api/knowledge.md. The knowledge file is generated automatically from the public pages of the site using a Python script. HeshBot is programmed to answer only from the core facts and knowledge file, to say when it does not know an answer, and to never invent prices, dates, or credentials.\n\nThere are three ways to power a chatbot like HeshBot:\n1. A public API, which sends questions to a hosted model and shows the reply. This approach is fast but leaves questions outside the server and is subject to third-party quotas and pricing.\n2. A local LLM, which runs an open model on local hardware instead of a public API. This option has no per-message cost, but it requires sufficient hardware and maintenance.\n3. A quick local decision model, which uses a small classifier or set of rules to match questions to known answers and reply instantly without a language model. This approach is less conversational but very cost-effective and not prone to hallucinations.",
  "summary": "The chat bubble on trevorheshka.com is HeshBot, a chatbot I wrote to replace the Typebot widget I had before. I wanted something small that I fully own: no build step, no framework, no third-party chat platform. The code is open source under the MIT license at github.com/YardPhantom/HeshBot . This post covers how it's put together, the different ways you could power a bot like this, and what a…",
  "key_points": [
    "HeshBot is a self-hosted website chatbot created by Trevor Heshka",
    "Three main components: widget, endpoint, and knowledge source",
    "Three powering options: public API, local LLM, quick local decision model"
  ],
  "editors_take": "Providing a lightweight, self-hosted alternative to proprietary widgets allows developers to maintain control over data privacy and costs by choosing between public APIs, local hardware, or rule-based logic.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}