Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

FastAPI init structure #12172

Irfan-Ahmad-byte started this conversation in Show and tell
Discussion options

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:

  1. create a complete modular project structure (this will be good for big projects development)
  2. create a very simple API setup
  3. rather than interacting through separate libraries, use setup FastAPI CLi to generate and run migrations
  4. additionally, we can add command for a complete Full Stack project structure like that of the Full Stack FASTAPI Template
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.