DEV Community

Jacob
Jacob

Posted on

How I Built a 10KB Embeddable Chat Widget on Cloudflare Workers

I wanted to add live chat to my WordPress sites without loading a 500KB third-party script. So I built my own.

GhostChat is an open source embeddable
chat widget that runs on Cloudflare Workers and Durable Objects.
The client widget is under 10KB. Here's how it works.

The architecture

  • Widget: Vanilla JS, no framework, ~10KB
  • Backend: Cloudflare Workers + Durable Objects for persistent WebSocket connections
  • Payments: Stripe for the hosted tier
  • Self-hostable: Bring your own Cloudflare account

Why Cloudflare Durable Objects?

Durable Objects give you stateful serverless — each chat session
lives in its own DO instance. No Redis, no external DB needed for
real-time state. It's genuinely elegant for this use case.

The "bring your own agent" model

GhostChat supports a webhook architecture so you can pipe messages to any AI agent, your own backend, or a human operator. You're not locked into our AI.

WordPress plugin

There's a WordPress plugin available so site owners can drop it in without touching code:
wordpress.org/plugins/ghostchat

Try it

Happy to answer questions about the Durable Objects architecture
in the comments

Top comments (0)