Lightweight self-hosted chat interface for Claude using Node.js, Express, and SSE.
https://github.com/davidbmar/claude-chat-workspace · public · shipped
A minimal Node.js/Express server that provides a clean, static single-page UI for chatting with Anthropic's Claude models. It supports Server-Sent Events (SSE) for real-time streaming responses, maintains per-session conversation history in memory, and is designed to be deployed as a containerized workspace pod (e.g., in Kubernetes or via Docker Compose).
cp .env.example .env # Edit .env to set ANTHROPIC_API_KEY docker compose up
flowchart TD
User[User Browser] -->|HTTP GET /| StaticUI[Static SPA UI]
User -->|POST /chat| Server[Node.js Express Server]
Server -->|SSE Stream| User
Server -->|API Call| Anthropic[Claude API]
Server -->|Read/Write| MemStore[(In-Memory Conversation Map)]
subgraph Container
StaticUI
Server
MemStore
end
Built with Node.js and Express for the backend, serving a static HTML/JS frontend. It uses the @anthropic-ai/sdk to interact with the Claude API. Conversation state is held in a JavaScript Map in memory, resetting on restart. The UI communicates with the backend via HTTP POST for sending messages and consumes SSE streams for receiving token-by-token responses.
sequenceDiagram
participant U as User
participant S as Express Server
participant M as Memory Store
participant A as Anthropic API
U->>S: POST /chat (message, sessionId)
S->>M: Get/Create conversation history
S->>A: Stream completion request
A-->>S: SSE Token Stream
S-->>U: Forward SSE Tokens
S->>M: Update conversation history
Deploy as a sidecar or standalone pod in a Kubernetes cluster alongside other development tools, or run locally via Docker Compose for a private, persistent chat interface without relying on third-party hosted UIs.