https://github.com/tuan3w/python-rest-template
A clean, scalable, i18n ready FastAPI template
https://github.com/tuan3w/python-rest-template
boilerplate dependency-injection domain-driven-design fastapi i18n python rest-api sqlalchemy template
Last synced: 6 months ago
JSON representation
A clean, scalable, i18n ready FastAPI template
- Host: GitHub
- URL: https://github.com/tuan3w/python-rest-template
- Owner: tuan3w
- License: mit
- Created: 2022-05-14T02:10:35.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-05T23:32:13.000Z (over 2 years ago)
- Last Synced: 2025-07-03T11:01:47.023Z (10 months ago)
- Topics: boilerplate, dependency-injection, domain-driven-design, fastapi, i18n, python, rest-api, sqlalchemy, template
- Language: Python
- Homepage:
- Size: 220 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# python-rest-template
A clean Python template for your next REST projects.
## Features
- [x] Scalable folder structure
- [x] Consistent style, be productive with useful pre-commit hooks
- [x] i18n support
## Sample App
This repo contains a demo for a chat app. You can create threads, messages.
Here are all APIs in the repo:

## Setup
You need to install [Pipenv](https://pipenv.pypa.io/en/latest/) in your machine.
```bash
pipenv shell
pipenv install
pipenv install --dev
pre-commit install # install pre-commit hooks
```
## Run app
```bash
cp config.yaml.example config.yaml
# update your app config in config.yaml
pipenv run app
```
Now, you can check API docs located at http://localhost:8000/docs .
## Test apps
```bash
pipenv run test
```
To show code coverage, just run:
```bash
pipenv run test-cov
```
In order to show code coverage in VsCode, you will need to install [Coverage Gutters extension](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters).
## Database migration
```bash
cp alembic.ini.example alembic.ini
# update alembic.ini config file
alembic upgrade head
```
## Error code localization with i18n
```bash
./extract_messages.sh
# update your translation in `base.po` files
./update_translation.sh
```
## License
[MIT](LICENSE)