claude-chat-workspace

Lightweight self-hosted chat interface for Claude using Node.js, Express, and SSE.

https://github.com/davidbmar/claude-chat-workspace  ·  public  ·  shipped

What it is

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).

Features

Quickstart

cp .env.example .env
# Edit .env to set ANTHROPIC_API_KEY
docker compose up

Architecture

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

How it's built

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.

How it runs

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

How to apply & reuse

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.

At a glance

CapabilitiesChat InterfaceSSE StreamingSession ManagementContainer Deployment
ComponentsExpress ServerStatic FrontendAnthropic SDK ClientIn-Memory Store
TechNode.jsExpressDockerServer-Sent EventsShell
Depends on@anthropic-ai/sdkexpressdotenv
Integrates withAnthropic Claude APIKubernetesAWS ECS/ECR
PatternsServer-Sent EventsIn-Memory StateContainerized MicroserviceAdapter Pattern (LLM Backend)
Reuse tagschat-uiclaude-wrapperself-hostednodejs-templatesse-streaming

⚠ Needs attention