The boilerplate for the project using restful Fastapi framework
- The entry point of the code
- Store configuration from env variables
we put everything else here, i.e. interfaces, cache, databases, ORM, i18n, monitor, logging, etc.
- sql migration files
- unit test directory
- Store documents files
- Init the database (do this only for the first time)
$ make prestart-db-init
- Run the app:
$ make run
- Open browser at:
http://localhost:8000/docs
- Authentication
- Login at
api/v1/login/access-token
with username, pass predefined in.env
- Add header
Authorization
:Bearer {{access_token}}
for any request
- Login at
$ pytest tests
$ pylint ./app
$ mypy ./app
$ black ./tests
- API design: guide
- Code style: Pep8 coding style
- import statement: better to import only necessary function not entire package, i.e. if you only need sqrt():
Recommended: from math import sqrt
Not recommended: import math
- Exception - EAFP principle: use except/try instead of if/else, and try to use specific exceptions instead of generic exception.
We use SemVer for versioning. Please see CHANGELOG.md for more details.
Please follow our contribution convention at contribution instructions and code of conduct.
To set up development environment, simply run:
$ pip install -r requirements.txt
If you like this project, you can buy buy me a pizza to motivate me improve on the project.