fastapi-fast-template


Namefastapi-fast-template JSON
Version 0.0.7 PyPI version JSON
download
home_pagehttps://github.com/heysaeid/fastapi-fast-template
SummaryThis library helps you not get involved in the complexities of FastAPI and its libraries and focus all your attention on the application.
upload_time2024-10-22 08:59:32
maintainerNone
docs_urlNone
authorSaeid Noormohammadi
requires_python<4.0,>=3.7
licenseMIT
keywords fastapi fastapi template fastapi fast template fastapi boilerplate
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # FastAPI Fast Template
[![Package version](https://img.shields.io/pypi/v/fastapi-fast-template?color=%2334D058&label=pypi%20package)](https://pypi.org/project/fastapi-fast-template/)
[![Downloads](https://img.shields.io/pypi/dm/fastapi-fast-template)](https://pypi.org/project/fastapi-fast-template/)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/fastapi-fast-template.svg?color=%2334D058)](https://pypi.org/project/fastapi-fast-template/)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/heysaeid/fastapi-fast-template/blob/master/LICENSE)

This library helps you not get involved in the complexities of FastAPI and its libraries and focus all your attention on the application.


## Features
- Proper structure and ready
- [Ruff](https://github.com/astral-sh/ruff) - An extremely fast Python linter and code formatter, written in Rust.
- [pre-commit](https://pre-commit.com/) - A framework for managing and maintaining multi-language pre-commit hooks.
- [SQLAlchemy](https://sqlalchemy.org/) - SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL
- [Tortoise ORM](https://tortoise.github.io/) - Tortoise ORM is an easy-to-use asyncio ORM (Object Relational Mapper) inspired by Django.
- [SQLModel ORM](https://sqlmodel.tiangolo.com/) - SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.
- [Beanie ODM](https://beanie-odm.dev/) - Beanie - is an asynchronous Python object-document mapper (ODM) for MongoDB.
- [fastapi-and-logging](https://github.com/heysaeid/fastapi-and-logging) - FastAPI-and-Logging simplifies log handling, allowing for effective organization, tracking, and analysis of logs in FastAPI applications, aiding in debugging and issue resolution.

- [fastapi-and-caching](https://github.com/heysaeid/fastapi-and-caching) - FastAPI and Caching is an extension for FastAPI that provides support for various caching mechanisms, allowing you to easily leverage caching within your FastAPI applications.
- [fastapi-and-babel](https://github.com/heysaeid/fastapi-and-babel.git) - FastAPIAndBabel allows you to easily use babel in your FastAPI projects and offers some features to improve and ease things.
- [APScheduler](https://apscheduler.readthedocs.io/en/3.x/) Advanced Python Scheduler (APScheduler) is a Python library that lets you schedule your Python code to be executed later, either just once or periodically.
- [FastStream](https://faststream.airt.ai/latest/) - the simplest way to work with a messaging queues
- [Authx](https://github.com/yezz123/AuthX) - Ready-to-use and customizable Authentications and Oauth2 management for FastAPI ⚡
- [FastAPI Cloud Auth(<b style="color:green">Coming Soon...</b>)](https://github.com/tokusumi/fastapi-cloudauth)
- [FastAPI Admin(<b style="color:green">Coming Soon...</b>)](https://github.com/fastapi-admin/fastapi-admin)
- [FastAPI MVC(<b style="color:green">Coming Soon...</b>)](https://github.com/fastapi-mvc/fastapi-mvc)
- [Fastapi-mail(<b style="color:green">Coming Soon...</b>)](https://github.com/sabuhish/fastapi-mail)


## Install
```
pip install fastapi-fast-template
```


# Usage
By executing the following command, you initiate the project configuration.

```shell
fast init
-- Enter the name of the application (default: Fast Template): FastTemplate
-- Enter the config module type (default: multiple): single or multiple
-- Enter the ORM/ODM (default: sqlalchemy): sqlalchemy, tortoise, sqlmodel or beanie
Initializing has been done successfully.
```
🥳🥳, your project has been created!


```
.
├── logs/
├── src/
│   ├── models/
│   ├── repositories/
│   │   ├── base.py
│   ├── routers/
│   │   ├── __init__.py
│   ├── schemas/
│   ├── services/
│   ├── utils/
│   │   ├── lifespan.py
│   ├── app.py
│   ├── config.py
│   ├── database.py
│   ├── main.py
├── tests/
├── LICENSE
├── .env
├── .env.sample
├── .fast_template.ini
├── .gitignore
├── .pre-commit-config.yaml
└── ruff.toml
```
Now, you can run it as follows.
```shell
python src/main.py
INFO:     Will watch for changes in these directories: ['.']
INFO:     Loading environment from '.env'
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [44167] using StatReload
INFO:     Started server process [44175]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
```

## Extensions
### Babel
You can add Babel to your project as follows.
```
fast extension --name babel
Please select the default language (default: en): fa
...
...
...
compiling catalog translations/fa/LC_MESSAGES/messages.po to translations/fa/LC_MESSAGES/messages.mo

```
For more information, [click here](https://github.com/heysaeid/fastapi-and-babel).

<hr>

### APScheduler
You can add APScheduler to your project as follows.
```
fast extension --name scheduler
```
To use it, you can check the "tasks" directory and the "\_\_init__.py" module.
```python
from tasks import scheduler

async def fast_template_scheduler():
    print("FastAPI Fast Template")

scheduler.add_job(
    func = fast_template_scheduler,
    trigger = CronTrigger(minute = "*/30", timezone = "Asia/Tehran")
)
```
By running the project, the scheduler is executed.

For more information, [click here](https://apscheduler.readthedocs.io/en/3.x/).
<hr>

### FastAPI-And-Caching
You can add caching to your project as follows.
```
fast extension --name caching
```

To use it, you can check the "utils" directory and the "caching.py" module.
```python
from utils.caching import cache

@app.get("/")
@cache.cached(key="root", expire=30, prefix="router")
def root():
    return "FastAPI Fast Template"
```

For more information, [click here](https://github.com/heysaeid/fastapi-and-caching).

<hr>

### FastAPI-And-Logging
You can add logging to your project as follows.
```
fast extension --name logging
Please select the log type (default: incoming): (choose from incoming, apicall, exception)
```
You can now check out the app.py module and apply your changes to it.

For more information, [click here](https://github.com/heysaeid/fastapi-and-logging).

<hr>

### FastStream
You can add broker to your project as follows.
```
fast extension --name stream
Please select the broker (default: redis): (choose from redis, aiokafka, confluent, rabbit, nats)
```
You can run it with the following command
‍‍‍‍‍
```shell
faststream run src.stream:app
```

For more information, [click here](https://github.com/airtai/faststream).


## Documents
You can have direct access to the documentation of each library used by using the following command.
```shell
fast doc


        Quick access to the documents of the tools used in this template.
        ___________________________________

        👉 FastAPI                            https://fastapi.tiangolo.com
        👉 SQLAlchemy                         https://www.sqlalchemy.org
        👉 Tortoise ORM                       https://tortoise.github.io
        👉 SQLModel ORM                       https://sqlmodel.tiangolo.com
        👉 Beanie ODM                         https://beanie-odm.dev
        👉 FastAPI-And-Babel                  https://github.com/heysaeid/fastapi-and-babel
        👉 FastAPI-And-Logging                https://github.com/heysaeid/fastapi-and-logging
        👉 FastAPI-And-Caching                https://github.com/heysaeid/fastapi-and-caching
        👉 APScheduler                        https://fastapi.tiangolo.com
        👉 FastStream                         https://faststream.airt.ai
        👉 AuthX                              https://github.com/yezz123/authx
        And ...
        ___________________________________

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/heysaeid/fastapi-fast-template",
    "name": "fastapi-fast-template",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.7",
    "maintainer_email": null,
    "keywords": "fastapi, fastapi template, fastapi fast template, fastapi boilerplate",
    "author": "Saeid Noormohammadi",
    "author_email": "heysaeid92@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/59/0a/80b021832f2d994929651061f435f96fa10d355a610d583e8d5a91121bea/fastapi_fast_template-0.0.7.tar.gz",
    "platform": null,
    "description": "# FastAPI Fast Template\n[![Package version](https://img.shields.io/pypi/v/fastapi-fast-template?color=%2334D058&label=pypi%20package)](https://pypi.org/project/fastapi-fast-template/)\n[![Downloads](https://img.shields.io/pypi/dm/fastapi-fast-template)](https://pypi.org/project/fastapi-fast-template/)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/fastapi-fast-template.svg?color=%2334D058)](https://pypi.org/project/fastapi-fast-template/)\n[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/heysaeid/fastapi-fast-template/blob/master/LICENSE)\n\nThis library helps you not get involved in the complexities of FastAPI and its libraries and focus all your attention on the application.\n\n\n## Features\n- Proper structure and ready\n- [Ruff](https://github.com/astral-sh/ruff) - An extremely fast Python linter and code formatter, written in Rust.\n- [pre-commit](https://pre-commit.com/) - A framework for managing and maintaining multi-language pre-commit hooks.\n- [SQLAlchemy](https://sqlalchemy.org/) - SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL\n- [Tortoise ORM](https://tortoise.github.io/) - Tortoise ORM is an easy-to-use asyncio ORM (Object Relational Mapper) inspired by Django.\n- [SQLModel ORM](https://sqlmodel.tiangolo.com/) - SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.\n- [Beanie ODM](https://beanie-odm.dev/) - Beanie - is an asynchronous Python object-document mapper (ODM) for MongoDB.\n- [fastapi-and-logging](https://github.com/heysaeid/fastapi-and-logging) - FastAPI-and-Logging simplifies log handling, allowing for effective organization, tracking, and analysis of logs in FastAPI applications, aiding in debugging and issue resolution.\n\n- [fastapi-and-caching](https://github.com/heysaeid/fastapi-and-caching) - FastAPI and Caching is an extension for FastAPI that provides support for various caching mechanisms, allowing you to easily leverage caching within your FastAPI applications.\n- [fastapi-and-babel](https://github.com/heysaeid/fastapi-and-babel.git) - FastAPIAndBabel allows you to easily use babel in your FastAPI projects and offers some features to improve and ease things.\n- [APScheduler](https://apscheduler.readthedocs.io/en/3.x/) Advanced Python Scheduler (APScheduler) is a Python library that lets you schedule your Python code to be executed later, either just once or periodically.\n- [FastStream](https://faststream.airt.ai/latest/) - the simplest way to work with a messaging queues\n- [Authx](https://github.com/yezz123/AuthX) - Ready-to-use and customizable Authentications and Oauth2 management for FastAPI \u26a1\n- [FastAPI Cloud Auth(<b style=\"color:green\">Coming Soon...</b>)](https://github.com/tokusumi/fastapi-cloudauth)\n- [FastAPI Admin(<b style=\"color:green\">Coming Soon...</b>)](https://github.com/fastapi-admin/fastapi-admin)\n- [FastAPI MVC(<b style=\"color:green\">Coming Soon...</b>)](https://github.com/fastapi-mvc/fastapi-mvc)\n- [Fastapi-mail(<b style=\"color:green\">Coming Soon...</b>)](https://github.com/sabuhish/fastapi-mail)\n\n\n## Install\n```\npip install fastapi-fast-template\n```\n\n\n# Usage\nBy executing the following command, you initiate the project configuration.\n\n```shell\nfast init\n-- Enter the name of the application (default: Fast Template): FastTemplate\n-- Enter the config module type (default: multiple): single or multiple\n-- Enter the ORM/ODM (default: sqlalchemy): sqlalchemy, tortoise, sqlmodel or beanie\nInitializing has been done successfully.\n```\n\ud83e\udd73\ud83e\udd73, your project has been created!\n\n\n```\n.\n\u251c\u2500\u2500 logs/\n\u251c\u2500\u2500 src/\n\u2502   \u251c\u2500\u2500 models/\n\u2502   \u251c\u2500\u2500 repositories/\n\u2502   \u2502   \u251c\u2500\u2500 base.py\n\u2502   \u251c\u2500\u2500 routers/\n\u2502   \u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 schemas/\n\u2502   \u251c\u2500\u2500 services/\n\u2502   \u251c\u2500\u2500 utils/\n\u2502   \u2502   \u251c\u2500\u2500 lifespan.py\n\u2502   \u251c\u2500\u2500 app.py\n\u2502   \u251c\u2500\u2500 config.py\n\u2502   \u251c\u2500\u2500 database.py\n\u2502   \u251c\u2500\u2500 main.py\n\u251c\u2500\u2500 tests/\n\u251c\u2500\u2500 LICENSE\n\u251c\u2500\u2500 .env\n\u251c\u2500\u2500 .env.sample\n\u251c\u2500\u2500 .fast_template.ini\n\u251c\u2500\u2500 .gitignore\n\u251c\u2500\u2500 .pre-commit-config.yaml\n\u2514\u2500\u2500 ruff.toml\n```\nNow, you can run it as follows.\n```shell\npython src/main.py\nINFO:     Will watch for changes in these directories: ['.']\nINFO:     Loading environment from '.env'\nINFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)\nINFO:     Started reloader process [44167] using StatReload\nINFO:     Started server process [44175]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\n```\n\n## Extensions\n### Babel\nYou can add Babel to your project as follows.\n```\nfast extension --name babel\nPlease select the default language (default: en): fa\n...\n...\n...\ncompiling catalog translations/fa/LC_MESSAGES/messages.po to translations/fa/LC_MESSAGES/messages.mo\n\n```\nFor more information, [click here](https://github.com/heysaeid/fastapi-and-babel).\n\n<hr>\n\n### APScheduler\nYou can add APScheduler to your project as follows.\n```\nfast extension --name scheduler\n```\nTo use it, you can check the \"tasks\" directory and the \"\\_\\_init__.py\" module.\n```python\nfrom tasks import scheduler\n\nasync def fast_template_scheduler():\n    print(\"FastAPI Fast Template\")\n\nscheduler.add_job(\n    func = fast_template_scheduler,\n    trigger = CronTrigger(minute = \"*/30\", timezone = \"Asia/Tehran\")\n)\n```\nBy running the project, the scheduler is executed.\n\nFor more information, [click here](https://apscheduler.readthedocs.io/en/3.x/).\n<hr>\n\n### FastAPI-And-Caching\nYou can add caching to your project as follows.\n```\nfast extension --name caching\n```\n\nTo use it, you can check the \"utils\" directory and the \"caching.py\" module.\n```python\nfrom utils.caching import cache\n\n@app.get(\"/\")\n@cache.cached(key=\"root\", expire=30, prefix=\"router\")\ndef root():\n    return \"FastAPI Fast Template\"\n```\n\nFor more information, [click here](https://github.com/heysaeid/fastapi-and-caching).\n\n<hr>\n\n### FastAPI-And-Logging\nYou can add logging to your project as follows.\n```\nfast extension --name logging\nPlease select the log type (default: incoming): (choose from incoming, apicall, exception)\n```\nYou can now check out the app.py module and apply your changes to it.\n\nFor more information, [click here](https://github.com/heysaeid/fastapi-and-logging).\n\n<hr>\n\n### FastStream\nYou can add broker to your project as follows.\n```\nfast extension --name stream\nPlease select the broker (default: redis): (choose from redis, aiokafka, confluent, rabbit, nats)\n```\nYou can run it with the following command\n\u200d\u200d\u200d\u200d\u200d\n```shell\nfaststream run src.stream:app\n```\n\nFor more information, [click here](https://github.com/airtai/faststream).\n\n\n## Documents\nYou can have direct access to the documentation of each library used by using the following command.\n```shell\nfast doc\n\n\n        Quick access to the documents of the tools used in this template.\n        ___________________________________\n\n        \ud83d\udc49 FastAPI                            https://fastapi.tiangolo.com\n        \ud83d\udc49 SQLAlchemy                         https://www.sqlalchemy.org\n        \ud83d\udc49 Tortoise ORM                       https://tortoise.github.io\n        \ud83d\udc49 SQLModel ORM                       https://sqlmodel.tiangolo.com\n        \ud83d\udc49 Beanie ODM                         https://beanie-odm.dev\n        \ud83d\udc49 FastAPI-And-Babel                  https://github.com/heysaeid/fastapi-and-babel\n        \ud83d\udc49 FastAPI-And-Logging                https://github.com/heysaeid/fastapi-and-logging\n        \ud83d\udc49 FastAPI-And-Caching                https://github.com/heysaeid/fastapi-and-caching\n        \ud83d\udc49 APScheduler                        https://fastapi.tiangolo.com\n        \ud83d\udc49 FastStream                         https://faststream.airt.ai\n        \ud83d\udc49 AuthX                              https://github.com/yezz123/authx\n        And ...\n        ___________________________________\n\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This library helps you not get involved in the complexities of FastAPI and its libraries and focus all your attention on the application.",
    "version": "0.0.7",
    "project_urls": {
        "Documentation": "https://github.com/heysaeid/fastapi-fast-template",
        "Homepage": "https://github.com/heysaeid/fastapi-fast-template",
        "Repository": "https://github.com/heysaeid/fastapi-fast-template"
    },
    "split_keywords": [
        "fastapi",
        " fastapi template",
        " fastapi fast template",
        " fastapi boilerplate"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a48d928f598c74d536c2e6f7772bb4e494ee0b8ac3b051347931ebbf2d3a0214",
                "md5": "4f223f6344654fa217231e31f52b4e65",
                "sha256": "012d4ce301c78de96d47efb63b187ce6abea1ed29e3569bc670873675b92df6a"
            },
            "downloads": -1,
            "filename": "fastapi_fast_template-0.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4f223f6344654fa217231e31f52b4e65",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.7",
            "size": 36218,
            "upload_time": "2024-10-22T08:59:29",
            "upload_time_iso_8601": "2024-10-22T08:59:29.408089Z",
            "url": "https://files.pythonhosted.org/packages/a4/8d/928f598c74d536c2e6f7772bb4e494ee0b8ac3b051347931ebbf2d3a0214/fastapi_fast_template-0.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "590a80b021832f2d994929651061f435f96fa10d355a610d583e8d5a91121bea",
                "md5": "aa48cb38ed002e7c998d0cac0dc50ea3",
                "sha256": "b5e8989c5f4fb4bdcfd14247ce38ab8b3dafef8aab2f421071e831d54ca1a778"
            },
            "downloads": -1,
            "filename": "fastapi_fast_template-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "aa48cb38ed002e7c998d0cac0dc50ea3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.7",
            "size": 23250,
            "upload_time": "2024-10-22T08:59:32",
            "upload_time_iso_8601": "2024-10-22T08:59:32.666692Z",
            "url": "https://files.pythonhosted.org/packages/59/0a/80b021832f2d994929651061f435f96fa10d355a610d583e8d5a91121bea/fastapi_fast_template-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-22 08:59:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "heysaeid",
    "github_project": "fastapi-fast-template",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "fastapi-fast-template"
}
        
Elapsed time: 0.41486s