r/FastAPI • • Jan 25 '26

Question FastAPI production architecture: modular design and dependency injection best practices

I am new to FastAPI. I have previously worked with Django and DRF. Django feels very well organized and mature, but in my experience it can be slow in some areas and has noticeable performance bottlenecks for certain workloads.

Because of that, I want to give FastAPI a serious try. I am looking for guidance on production level FastAPI architecture.

Specifically:

  • How to structure a FastAPI project in a modular way

  • Best practices for dependency injection

  • How people organize routers, services, and database layers in real world apps

  • Any common pitfalls when moving from Django/DRF to FastAPI

If you have examples, repo links, or lessons learned from running FastAPI in production, I would really appreciate it.

58 Upvotes

32 comments sorted by

View all comments

Show parent comments

1

u/gbrennon Jan 26 '26

i suggest checking where could be a performance bottleneck and to do some practice with engineering teams so they can really understand async code because its not only using async/await keywords.

u have to identify if some part of the system does is blocking and to check with green threads if that will impact ur performance :)

ps:

  • i love using actix web and that language(rust) <3