🚀 How I Structure a FastAPI Backend with LLM Features (From a Real Project)
How I Structure a FastAPI Backend with LLM Features (From a Real Project) I Don’t Start With Endpoints Anymore When I used to start backend projects, I’d jump straight into writing routes. That worked… until the project grew. Now, I start with something else: “How will this project fall apart in 3 months?” Because it will — especially if you’re using LLMs. You’ll start seeing: prompts copied across files random LLM calls inside endpoints parsing logic that no one wants to touch “temporary” hacks that become permanent So these days, I focus heavily on structure first, features second. This post is how I structured a FastAPI backend with LLM integration for a real estate consultant system — and what actually held up. FastAPI vs Express — Different Problems Coming from Node.js + Express, I was used to this: routes/ controllers/ services/ models/ Flexible, simple… and easy to mess up. Over time: controllers get bloated services become dumping grounds logic gets duplicated With FastAPI, the issue is different: It gives you powerful tools, but no strong opinion on structure. So people end up with: everything inside main.py business logic inside route handlers LLM calls scattered everywhere And once LLM is involved, things get chaotic fast. The Project (Real Context) This is from a real project: A backend that collects user preferences, uses an LLM to interpret them, and guides real estate search. Not just CRUD. It includes: multi-step intake flow LLM-based parsing dynamic question ...
👉 Read more: https://dev.to/aichannode/how-i-structure-a-fastapi-backend-with-llm-features-from-a-real-project-1kb7
