dumbchat

A lightweight, embeddable real-time chat widget written in Go.
This project supports:
- Live messaging via WebSockets
- Admin message deletion
- Nickname filtering (prohibited words)
- Dark mode
- Embedding into existing Go projects or static sites (Hugo + Nginx)
Tech Stack
- Go (net/http, html/template)
- PostgreSQL
- SQLite
- Gorilla WebSocket
- Chi router
- htmx
Build & Run
1. Clone the repository
git clone https://github.com/acakp/dumbchat.git
cd dumbchat
2. Build the binary
GOOS=linux GOARCH=amd64 go build -o dumbchat
3. Run locally
./dumbchat
The server will start on the configured port (default: :8888).
Configuration
Configuration is done via environment variables:
HTTP_PORT='8888'
CHAT_BASE_PATH='/chat'
ADMIN_PASSWORD_HASH='paste bcrypt hash of your password here'
BANNED_NICKNAMES='admin,owner'
# 'sqlite' or 'postgres'
DB='sqlite'
# only if you use postgres:
PGHOST='localhost'
PGPORT='5432'
PGDBNAME='dumbchat'
PGUSER='dbuser'
PGPASSWORD='mypassword'
Embedding
- Add these lines to the html page where you want to embed the chat:
Into the <head>:
<link rel="stylesheet" href="/static/styles.css">
<script src="/static/htmx.js"></script>
Into the <body> (in hx-get you should specify your base path from .env):
<div hx-get="/chat" hx-trigger="load" hx-swap="innerHTML">
</div>