System Design: In-Browser AI Chat With Streaming
Requirements
Design a web-based AI chatbot system that satisfies all of the following:
-
User messages and full conversation history are stored only in the browser (no backend database or server-side persistence).
-
Bot responses are streamed to the user token-by-token (or chunk-by-chunk).
-
Refreshing the page starts a new conversation (no history survives a reload).
-
Handle user credential and security considerations.
Assume a typical SPA front end and that you may use a stateless backend relay to call an external LLM provider, but you must not persist user messages server-side.