Both halves work and the join does not. This is the characteristic stage of a first application, and the problems are rarely deep: they come from a short list of causes that everybody hits once and then recognises forever.
What are the usual causes?
- Cross-origin restrictions. The browser refusing a request between different addresses.
- Shape mismatch. The front end expecting a different structure from what arrives.
- Nothing handling failure. A request fails and the interface shows nothing.
- Timing. Something rendering before the data arrives.
- Authentication not travelling. Credentials not attached to the request.
How do you diagnose any of them?
The browser network panel, which shows exactly what was sent, what came back and what status. Most of an evening's confusion resolves in thirty seconds there, and it is the first place to look rather than the last.
Learning to read it properly is the highest-value hour available at this stage.
What causes cross-origin errors?
The front end being served from a different address from the back end, which the browser blocks unless the server explicitly permits it. It is a security feature rather than a fault, and the fix is a configuration on the server side.
Permitting everything makes it go away and is worth narrowing before anything is public.
Why do shape mismatches happen so often?
Because the two halves are written separately and nothing enforces agreement. A field renamed on one side breaks the other silently, and the symptom is an empty value rather than an error.
Defining the shape once and referring to it from both sides removes this entirely, and it is worth doing as soon as there are more than a few endpoints.
Duplicate submissions are the other common gap, since a slow request invites a second click and nothing prevents the same operation running twice.
What does generated code consistently omit?
Failure handling. The generated pattern fetches data and renders it, with no branch for a request that fails, times out or returns an error, so a broken connection produces a blank screen and no message.
Every request needs three states handled: loading, success and failure, with a readable message on failure and something visible while waiting. Add a timeout. Do not leave any path where a failed request produces nothing on screen.
Handling the case where the user leaves mid-request is worth a thought too, since a response arriving after somebody navigated away can produce errors that look unexplained in your tracking.
What about the network being slow?
Worth testing deliberately, since everything is instant locally. Browser tools can simulate a slow connection, and doing that once reveals every missing loading state immediately.
Do you need a separate front end at all?
Frequently not, for a first project. An application that renders pages on the server has no boundary to debug, no shape mismatches and no cross-origin configuration, which removes this entire category of problem.
Separating them is worth it when you genuinely need a rich interface, and it is a choice with a real cost rather than a default.
What about the AI calls specifically?
They break the assumptions the rest of your front end makes. A normal request returns in milliseconds; a model call can take many seconds, which means a spinner is not optional and a default timeout will frequently fire before the response arrives.
Streaming complicates it further, since the response arrives in pieces rather than at once, and generated code for a standard request does not handle that shape at all. It is worth treating these as a different kind of call with their own handling rather than assuming what works for the rest of the application will work here.
What is the debugging order?
Check the request was sent, check what came back, check the status code, then check what the front end did with it. Working through that in order locates almost every problem in this category in a couple of minutes.