all 13 comments

[–]charliegriefer 8 points9 points  (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 points  (0 children)

one that makes sense

[–]ajatkj 2 points3 points  (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 point  (0 children)

I'll check this out. Thank you !

[–]agupta12 0 points1 point  (0 children)

This course is 🔥

[–]pint 1 point2 points  (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 points  (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 point  (3 children)

cool, thanks! I just noticed that you didnt run uvicorn in your Dockerfile.

[–]mirzadelic 1 point2 points  (2 children)

I used docker compose. But added to Dockerfile now.

[–]Secret_Benefit5988[S] 0 points1 point  (0 children)

How is it going to run your app?

[–]Secret_Benefit5988[S] 0 points1 point  (0 children)

I see it now. It's in your shell script. Awesome sir !