A visual walkthrough of every layer — from the button you click to the AI reply that appears.
Each layer has exactly one job. Together they build a real-time AI chat app.
Follow one message — "What is Python?" — through every layer of the stack.
sendMessage() from the useChat hook, which serialises your text into JSON.user_message event back so React can show your bubble immediately.stream_chunk WebSocket event. This runs dozens of times per second.streamBuffer state. React re-renders the bubble with the growing text. You see words appear before Claude has finished.stream_end event. React finalises the bubble and clears streamBuffer.Both sides speak JSON. Click the button to simulate a full conversation round-trip.
Two containers, one private network, four magic tricks.
http://backend:8000 — Docker resolves the name. No IPs needed..env on your machine, injected at runtime — never baked into the image.GET /health → 200. No race conditions.dist/ folder moves to the Nginx stage. No Node in production.