- Python 3.10+
- MySQL 5.7+
- Poetry
git clone git@github.com:ducminh-phan/fastapi-service-template.git
cd fastapi-service-template
pyenv local 3.10.9
pyenv exec python3 -m venv venv
source ./venv/bin/activate
poetry install
Create a database
mysql -u root -p
mysql> CREATE DATABASE fastapi_template_development;
mysql> exit
In .env
file (create one if it doesn't exist), add database uri
SQLALCHEMY_DATABASE_URI=mysql+aiomysql://root:123456@127.0.0.1/fastapi_template_development
Then upgrade database
alembic upgrade head
-
Install
pre-commit
: https://pre-commit.com/ (should be installed globally) -
Install
pre-commit
hooks:make install-git-hooks
Inside the virtual environment, run
make run
Inside the virtual environment, run
make test