A tiny Node.js + LangChain web app that streams a joke and its punch-line for any topic you provide.
- Generates jokes with separate
jokeandpunchlinefields using a structured LLM call. - Web UI served via Express with WebSocket communication.
- Docker-ready (see
Dockerfile&docker-compose.yml).
- OpenAI API key – export
OPENAI_API_KEYin your shell or add it to the Compose file. - Node.js 20+ or Docker Desktop.
# install deps
npm install
# set your key
set OPENAI_API_KEY=sk-...
# start the server
npm start
# open the UI
http://localhost:2999# build & run
docker compose up --build
# UI will be available at
http://localhost:2999├─ public/ # browser UI
├─ index.js # main backend & LangChain chain
├─ Dockerfile # production image
├─ docker-compose.yml
└─ package.json
Enjoy the jokes!