DESCENT PROTOCOL // BOOTING

Loading Sequence  ·  0%

2025LiveSolo full-stack developer

JChat

A multi-personality AI chatbot with a Redis-backed job queue, a Node worker calling the Hugging Face API, and WebSocket push to the frontend.

Next.jsExpressWebSocketRedisHugging FaceTypeScript
JChat

Overview

JChat is a queued chat app, not a direct streaming one. The Next.js and React frontend sends messages to an Express and WebSocket backend, which pushes them into a Redis queue. A background Node worker pulls messages off the queue, calls the Hugging Face Inference API for the selected personality (Assistant, Luna, or Alex), stores the response in Redis history, and publishes to a per-session channel. The WebSocket relays the finished response back to the originating client. Session IDs are UUIDs kept in localStorage; conversation history lives in Redis.

Highlights

  • Three configurable AI personalities selected by per-personality system prompts.
  • Redis-backed job queue decoupling the request path from the model call.
  • Dedicated Node worker so Hugging Face API latency never blocks the web layer.
  • Per-session Redis pub/sub channels relayed to the client over WebSocket.

Challenges and approach

  • Direct HTTP to the model API coupled request latency to the chat UI. Moving the call behind a queue plus a worker kept the frontend responsive even when the provider throttled.
  • Routing worker responses back to the right client meant session-scoped pub/sub channels plus WebSocket subscription bookkeeping on reconnect.