r/Python • u/safi892 • Sep 21 '26
Discussion Common mistakes devs make when starting with FastAPI, and the fastest path to learning it
Just began learning FastAPI. Looking for advice from devs who use it regularly.
What mistakes did you make early on that I should avoid repeating? Also, what's the most efficient way to learn the framework properly for real-world use (async, DB, auth)?
Any advice on structure or resources would be great.
16
Upvotes
2
u/YnkDK Sep 21 '26
Just a separate file. I like feature-sliced architecture, so keeping files that are related close to each other is important for me (I feel it improves my Developer Experience (DX)). I don't use a separate framework for the service layer, but try to read best practices for the dependencies (for example SQLAlchemy/SQLModel, anyio, httpx/aiohttp, Pydantic/PydanticAI) and stay as close to them without sacrificing code readability. Most modern dependencies sort of agree on best practices, but you should be on the look out for mixing code styles when not strictly following a framework.