FastAPI init structure #12172
Irfan-Ahmad-byte
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have used FastAPI for almost all the backend related projects. I have been using Alembic/sqlalchemy for migrations. I follow a modular structure to keep my projects well managed, which I would like to share here. Let me first share my structure:
├── config // include additional configs, including ENV VARS
│ ├── config.py
│ ├── init.py
├── dependencies // dependencies including authentication(OAuth etc)
│ ├── init.py
│ └── security.py
├── executors // main executing functions behind each endpoint operation
│ ├── crud.py
│ ├── init.py
├── init.py
├── main.py // the main API file, combines all routers to run in the app
├── migrations // database migrations
│ ├── database.py
│ ├── init.py
│ └── users.py
├── routers // individual app routers for each separate kind of operations/tables, add into main for running
│ ├── intit.py
│ └── users.py
├── schemas // schemas/entities for CRUD (or other) operations
│ └── schemas.py
└── utils // other utilities
├── init.py
===========
This is the basic structure.
Now, I would like to contribute into FastAPI CLI features to:
Beta Was this translation helpful? Give feedback.
All reactions