{"id":23786323,"url":"https://github.com/plusiv/fastapi-tortoise-api-base","last_synced_at":"2026-04-13T16:30:19.157Z","repository":{"id":167741668,"uuid":"638527652","full_name":"plusiv/fastapi-tortoise-api-base","owner":"plusiv","description":"API Base for Fastapi + Tortoise ORM projects","archived":false,"fork":false,"pushed_at":"2023-11-20T15:39:11.000Z","size":696,"stargazers_count":3,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-01T14:16:37.801Z","etag":null,"topics":["api-base","api-rest","fastapi","tortoise-orm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plusiv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["plusiv"]}},"created_at":"2023-05-09T14:42:35.000Z","updated_at":"2024-09-21T12:32:40.000Z","dependencies_parsed_at":"2025-01-01T14:26:45.779Z","dependency_job_id":null,"html_url":"https://github.com/plusiv/fastapi-tortoise-api-base","commit_stats":null,"previous_names":["plusiv/fastapi-tortoise"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plusiv%2Ffastapi-tortoise-api-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plusiv%2Ffastapi-tortoise-api-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plusiv%2Ffastapi-tortoise-api-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plusiv%2Ffastapi-tortoise-api-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plusiv","download_url":"https://codeload.github.com/plusiv/fastapi-tortoise-api-base/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240002130,"owners_count":19732164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-base","api-rest","fastapi","tortoise-orm"],"created_at":"2025-01-01T14:16:38.704Z","updated_at":"2026-04-13T16:30:19.095Z","avatar_url":"https://github.com/plusiv.png","language":"Python","funding_links":["https://github.com/sponsors/plusiv"],"categories":[],"sub_categories":[],"readme":"# FastAPI Template Project\n\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)\n[![GitHub Super-Linter](https://github.com/plusiv/fastapi-tortoise-api-base/actions/workflows/lint.yaml/badge.svg)](https://github.com/marketplace/actions/super-linter)\n\nThis is a template project for building API applications using FastAPI, Poetry, and Tortoise ORM. The base project is about a To-Do application, so, feel free of removing every line of code outside of your needs.\n\n## Prerequisites\n\nMake sure you have the following installed before setting up the project:\n\n- Python 3.11.3 or above\n- [Poetry](https://python-poetry.org/)\n- [Docker](https://www.docker.com/) (optional, required for running the database with Docker)\n\n## Project Setup\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/plusiv/fastapi-tortoise-api-base.git\n   cd fastapi-tortoise-api-base\n   ````\n\n2. Install the project dependencies using Poetry:\n\n    ```bash\n    # This will install all project dependencies.\n    poetry install\n    ```\n\n    _Optionally install [pre-commit](https://pre-commit.com/) hooks._\n\n    ```bash\n    # Install pre-commit (optional)\n    poetry run pre-commit install\n    ```\n\n3. Create `.env` file and add environmental variables values\n\n    ```bash\n    cp .env.example .env\n    vim .env\n    ```\n\n4. Run schema creation and seeders (optional):\n\n    ```bash\n    poetry run python -m app.database.db_seed\n    ```\n\n5. Run project\n\n    ```bash\n    poetry run uvicorn --reload app.main:app\n    ```\n\n### Tests\n\nTo run tests you can enter:\n\n```bash\npoetry run pytest\n```\n\n### Pre-commit\n\nIf you want to run pre-commit to make sure that you're doing a good jon, just run:\n\n```shell\npoetry run pre-commit run -a\n```\n\n## Tech Stack + Features\n\n### Frameworks\n\n- [FastApi](https://fastapi.tiangolo.com/lo/) – A modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.\n\n### Database + ORM\n\n- [MySQL](https://www.mysql.com/) - An open-source relational database management system.\n- [Tortoise ORM](https://tortoise.github.io/) - Tortoise ORM is an easy-to-use `asyncio` ORM (Object Relational Mapper) inspired by Django.\n\n### Storage\n\n- Minio - __TODO__\n\n### Access Control\n\n- [Casbin](https://github.com/casbin/pycasbin) - An authorization library that supports access control models like ACL, RBAC, ABAC for multiple Languajes.\n\n### Code Quality\n\n- [Super Linter (Github Action)](https://github.com/marketplace/actions/super-linter) - A simple combination of various linters, written in bash, to help validate your source code. Linters are:\n  - [Ruff](https://beta.ruff.rs/docs/) - An extremely fast Python linter, written in Rust.\n  - [Black](https://github.com/psf/black) - A Python code formatter.\n  - [Hadolint (Dockerfile)](https://github.com/hadolint/hadolint) - A smarter Dockerfile linter that helps to build best practice Docker images.\n  - Github Actions - A linter for Github Actions.\n  - Yaml - A Yaml files linter.\n  - Markdown - A Markdown linter.\n- [Pre Commit](https://pre-commit.com/) - Git hook scripts are useful for identifying simple issues before submission to code review.\n  - check-ast - simply checks whether the files parse as valid python.\n  - check-toml - checks toml files for parseable syntax.\n  - detect-private-key - detects the presence of private keys.\n  - end-of-file-fixer - ensures that a file is either empty, or ends with one newline.\n  - fix-encoding-pragma - adds `# -*- coding: utf-8 -*-` to the top of python files.\n  - name-tests-test - verifies that test files are named correctly.\n  - trailing-whitespace - trims trailing whitespace.\n  - black - A Python code formatter.\n  - ruff - An extremely fast Python linter, written in Rust.\n  - hadolint - A smarter Dockerfile linter that helps to build best practice Docker images.\n\n## Project Structure\n\nThis diagram assumes that all folder is a Python module and all of them have a hidden `__init__.py` file.\n\u003c!-- You can generate this tree diagram by running: tree -I __pycache__ -I __init__.py -I .git -I .env -I .ruff_cache -I migrations -I .pytest_cache -a . --\u003e\n\n```shell\n.\n├── .env.example\n├── .github\n│   └── workflows\n│       └── lint.yaml\n├── .gitignore\n├── .pre-commit-config.yaml\n├── Dockerfile\n├── LICENSE\n├── README.md\n├── app\n│   ├── core\n│   │   ├── email.py\n│   │   ├── security\n│   │   │   ├── access_control\n│   │   │   │   ├── access_control.py\n│   │   │   │   ├── model.conf\n│   │   │   │   └── policies.csv\n│   │   │   ├── hashing.py\n│   │   │   └── jwt_handler.py\n│   │   ├── settings.py\n│   │   └── sms.py\n│   ├── database\n│   │   ├── crud\n│   │   │   ├── todos.py\n│   │   │   ├── users.py\n│   │   │   └── utils\n│   │   │       └── utils.py\n│   │   ├── db_seed.py\n│   │   ├── models.py\n│   │   └── seeders\n│   │       └── sample_seeders.py\n│   ├── main.py\n│   ├── pydantic_models\n│   │   ├── messages.py\n│   │   ├── todos.py\n│   │   ├── tokens.py\n│   │   └── users.py\n│   ├── routers\n│   │   └── v1\n│   │       ├── api.py\n│   │       ├── dependencies.py\n│   │       └── endpoints\n│   │           ├── emails.py\n│   │           ├── login.py\n│   │           ├── sms.py\n│   │           ├── todos.py\n│   │           └── users.py\n│   └── utils\n│       └── utils.py\n├── docker-compose.yaml\n├── poetry.lock\n├── pyproject.toml\n└── tests\n    ├── api\n    │   └── endpoints\n    │       ├── ping_test.py\n    │       └── v1\n    │           └── user_test.py\n    └── conftest.py\n```\n\n### Application folder\n\n```shell\napp\n├── core\n├── database\n├── main.py\n├── pydantic_models\n├── routers\n└── utils\n```\n\nThe `app` folder is the root application folder, there you are goin to found all principal modules:\n\n- `core`: All core modules of the application, such as email, security module, access control and so on.\n- `database`: Handles everything about database, such as [CRUDS](https://www.sumologic.com/glossary/crud/), [Tortoise Models](https://tortoise.github.io/models.html), and some sample seeders.\n- `main.py`: Main app files, it initializes the entire application.\n- `pydantic_models`: This folder contains all Pydantic Models for data validation in all API information exchanges.\n- `routers`: All API endpoints versioned.\n- `utils`: Helper functions.\n\n### CI\n\n```shell\n.github\n└── workflows\n    └── lint.yaml\n```\n\nThis project is configured to use [Github Actions](https://github.com/features/actions), and all workflows file can be found in `.github/workflows` as spected.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplusiv%2Ffastapi-tortoise-api-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplusiv%2Ffastapi-tortoise-api-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplusiv%2Ffastapi-tortoise-api-base/lists"}