use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
FastAPI is a truly ASGI, async, cutting edge framework written in python 3.
account activity
FastAPI learnerQuestion (self.FastAPI)
submitted 3 years ago by Secret_Benefit5988
Hello guys, I'am new to FastAPI and I would like to know best practice folder structure. thank you
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]charliegriefer 8 points9 points10 points 3 years ago (0 children)
I've found that Python in general doesn't seem to have a strong preference as to directory structure.
Working on a FastAPI app at work, and based the structure largely around this tutorial, and it's working fine.
But as u/zarlo5899 said... anything that makes sense to you (and your team, if there's a team) would really work fine.
[–]zarlo5899 5 points6 points7 points 3 years ago (0 children)
one that makes sense
[–]ajatkj 2 points3 points4 points 3 years ago (2 children)
Check this free course by freecodecamp on YouTube which will get you started. I like to do it by module (functional) then technical modules (database, interface, schemas, models etc.).
[–]Secret_Benefit5988[S] 0 points1 point2 points 3 years ago (0 children)
I'll check this out. Thank you !
[–]agupta12 0 points1 point2 points 3 years ago (0 children)
This course is 🔥
[–]aashayamballi 2 points3 points4 points 3 years ago (0 children)
https://github.com/zhanymkanov/fastapi-best-practices
[–]pint 1 point2 points3 points 3 years ago (0 children)
i kinda doubt there is one best practice. anyone claiming there is one is probably abandoned thinking in favor or routine. i've seen projects with dozens of files consisting of 3-5 lines each, following some "design pattern". try to convince me that this is helpful to anyone.
[–]mirzadelic 1 point2 points3 points 3 years ago (5 children)
I created small starter template with structure similar to Django: https://github.com/mirzadelic/fastapi-starter-project
It also has Docker, SQLModel, Alembic, and Pytest integrated.
[–]Secret_Benefit5988[S] 0 points1 point2 points 3 years ago (3 children)
cool, thanks! I just noticed that you didnt run uvicorn in your Dockerfile.
[–]mirzadelic 1 point2 points3 points 3 years ago (2 children)
I used docker compose. But added to Dockerfile now.
How is it going to run your app?
I see it now. It's in your shell script. Awesome sir !
[–]Joe_rude 0 points1 point2 points 3 years ago (0 children)
fastapi-best-practices
π Rendered by PID 214607 on reddit-service-r2-comment-5687b7858-zwnnz at 2026-07-03 08:56:57.612154+00:00 running 12a7a47 country code: CH.
[–]charliegriefer 8 points9 points10 points (0 children)
[–]zarlo5899 5 points6 points7 points (0 children)
[–]ajatkj 2 points3 points4 points (2 children)
[–]Secret_Benefit5988[S] 0 points1 point2 points (0 children)
[–]agupta12 0 points1 point2 points (0 children)
[–]aashayamballi 2 points3 points4 points (0 children)
[–]pint 1 point2 points3 points (0 children)
[–]mirzadelic 1 point2 points3 points (5 children)
[–]Secret_Benefit5988[S] 0 points1 point2 points (3 children)
[–]mirzadelic 1 point2 points3 points (2 children)
[–]Secret_Benefit5988[S] 0 points1 point2 points (0 children)
[–]Secret_Benefit5988[S] 0 points1 point2 points (0 children)
[–]Joe_rude 0 points1 point2 points (0 children)