Template for python backend project using FastAPI+TortoiseORM+poetry+aerich
Inspired by full-stack-fastapi-template
- ⚡ FastAPI for the Python backend API.
- 🧰 TortoiseORM for the Python SQL database interactions (ORM).
- 🔍 Pydantic, used by FastAPI, for the data validation and settings management.
- ✅ Tests with Pytest.
poetry shell
poetry install
# For MySQL: poetry install -E mysql
# For PostgreSQL: poetry install -E postgres
aerich init-db
python app.py
You can just fork or clone this repository and use it as is.
✨ It just works. ✨
If you want to have a private repository, GitHub won't allow you to simply fork it as it doesn't allow changing the visibility of forks.
But you can do the following:
- Create a new GitHub repo, for example
my-backend-project
. - Clone this repository manually, set the name with the name of the project you want to use, for example
my-backend-project
:
git clone [email protected]:waketzheng/fastapi-tortoise-poetry-template.git my-backend-project
- Enter into the new directory:
cd my-backend-project
- Set the new origin to your new repository, copy it from the GitHub interface, for example:
git remote set-url origin [email protected]:octocat/my-backend-project.git
- Add this repo as another "remote" to allow you to get updates later:
git remote add upstream [email protected]:waketzheng/fastapi-tortoise-poetry-template.git
- Push the code to your new repository:
git push -u origin master