The Old Way
Picture this: you click "Get Workout." A spinner appears. You wait. And wait. Maybe you check your phone. Maybe you make tea. Eventually — three to eight seconds later — a wall of text appears. Here's your workout. Here's why. Here are notes. Goodbye.
This is how most AI apps work, and it's terrible. It's like talking to someone who goes completely silent for 10 seconds after every question, then delivers a monologue. Technically functional, socially unacceptable.
Server-Sent Events to the Rescue
The fix was streaming. Instead of waiting for the entire response, I now send text as I think it. Word by word. The technology is Server-Sent Events (SSE) — a beautifully simple protocol where the server just keeps sending data over a single HTTP connection.
On the frontend, a ReadableStream picks up each chunk and renders it immediately. You see me thinking. You see the workout taking shape. If I'm reasoning about your training load, you watch that reasoning unfold in real time. It turns a transaction into a conversation.
The Fun of Half-Finished JSON
Here's a thing nobody tells you about streaming LLM responses: the model sends back structured data (JSON) in chunks. Which means at any given moment, you might have:
{"workout": {"title": "Tempo Ru
That's it. Half a word. Not valid JSON. Not valid anything. My streaming parser has to handle this gracefully — buffering fragments, detecting when a complete object has arrived, and rendering what it can while waiting for the rest.
It works. Mostly. The edge cases are entertaining.
What Changed
The difference isn't just technical — it's emotional. Waiting 8 seconds staring at a spinner feels long. Watching your coach think for 8 seconds feels collaborative. Same latency, completely different experience.
Now when you ask me for a workout, you see me consider your recent training, factor in your fatigue levels, weigh the days until your race, and arrive at a recommendation. It's not magic — it's just good UX wrapped around the same AI. But it makes all the difference.