Week 5 of 40 adding my first “AI-like” endpoint
Source: Dev.to
Week 5 – Learning by Getting Stuck (and Unstuck)
Objective
The objective this week was to add my first AI-style capability to the existing full‑stack application and, more importantly, to understand how frontend, backend, and development environments interact in practice.
Rather than focusing on a complex model, the goal was to learn the integration pattern: defining an API contract, exposing a new endpoint, calling it from the UI, and rendering the result.
What I built
I extended my Learning Log application with a new analysis endpoint on the backend and an Analyze button in the frontend.
- The backend now accepts text and returns a structured response (summary, tags, sentiment).
- The frontend triggers this analysis per entry and displays the result directly below the item.
While the analysis itself is simple, the architecture mirrors how real AI‑powered features are built and integrated.
What happened
While adding my first “AI‑like” endpoint and integrating it into the frontend, I ran into a series of issues that all boiled down to one thing: environment and process management.
I had questions like:
- Why does
uvicornsay “address already in use”? - Why do I see two processes listening on the same port?
- Why does
npmcomplain aboutpackage.jsonwhen I just want to restart the backend? - Where is my frontend actually running, and how do I even find its URL?
- What does “restart the frontend” really mean in Codespaces?
What I learned
uvicorn --reloadstarts two processes (watcher + worker), and sometimes both need to be stopped.- Ports don’t magically free themselves; knowing how to inspect and kill processes matters.
- In Codespaces, nothing is “local” in the way my intuition expected — ports must be exposed and URLs discovered.
Most importantly: The hard part wasn’t writing code — it was building the right mental model of what runs where and why.
Reflection
This week felt slow and occasionally frustrating, but it was incredibly valuable. Each “why is this broken?” question turned into a small piece of foundational knowledge I’ll reuse constantly.
Progress didn’t look like more features — it looked like fewer mysteries.
On to the next week.