The template for building scalable web APIs based on FastAPI, Tortoise ORM and other.

Overview

FastAPI and Tortoise ORM.

Powerful but simple template for web APIs w/ FastAPI (as web framework) and Tortoise-ORM (for working via database without headache).

Features

* Deploy with Docker.
* Local development with docker-compose.
* Fast and powerful web framework and ORM.
* Clear and fast code.
* Some powerful utils out-of-the-box that highly customizable with tests.

How to use?

  1. Clone this repository (git clone https://github.com/prostomarkeloff/fastapi-tortoise)
  2. Rename .env.example to .env
  3. Delete unnecessary code (like hello router and tests for it)
  4. Customize!
Comments
  •  Service 'api' failed to build

    Service 'api' failed to build

    • git clone
    • cp .env.example .env
    • docker-compose -f docker-compose-dev.yml up
    [root@k38uq20rb3czmnz fastapi-tortoise]# docker-compose -f docker-compose-dev.yml up
    Building api
    Step 1/8 : FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
     ---> 23579a0a7c50
    Step 2/8 : RUN pip install poetry
     ---> Using cache
     ---> 6ce9991d8168
    Step 3/8 : RUN poetry config settings.virtualenvs.create false
     ---> Running in c967b38acf5a
    
    [ValueError]
    Setting settings.virtualenvs.create does not exist
    ERROR: Service 'api' failed to build: The command '/bin/sh -c poetry config settings.virtualenvs.create false' returned a non-zero code: 1
    
    
    opened by lihuacai168 1
  • Typos in fastapi-tortoise/app/config/db.py

    Typos in fastapi-tortoise/app/config/db.py

    POSGTRES_USER, POSGTRES_PASSWORD, POSGTRES_DB

    class PostgresSettings(BaseSettings):
        """Postgres env values"""
    
        postgres_user: str = Field("postgres", env="POSGTRES_USER")
        postgres_password: str = Field("postgres", env="POSGTRES_PASSWORD")
        postgres_db: str = Field("mydb", env="POSGTRES_DB")
        postgres_port: str = Field("5432", env="POSTGRES_PORT")
        postgres_host: str = Field("postgres", env="POSTGRES_HOST")
    

    Thanks for creating the project. Cheers, Paul.

    opened by pjcunningham 1
  • Fix poetry

    Fix poetry

    Remove settings from RUN poetry config settings.virtualenvs.create false because it isn't required anymore and will fail (See: https://stackoverflow.com/a/62071321/14796439)

    opened by 2e12 0
  • Traefik support

    Traefik support

    Motivation: You usually have a frontend and API, frontend runs at domain.com, api at api.domain.com and maybe you have a other services. Traefik helps you with it!

    opened by prostomarkeloff 0
  • running ./docker-dev-up.sh is throwing errors

    running ./docker-dev-up.sh is throwing errors

    api_1  |   File "/usr/local/lib/python3.7/site-packages/asyncpg/connect_utils.py", line 663, in _connect                                                                                       
    api_1  |     raise last_error                                                                                                                                                                  
    api_1  |   File "/usr/local/lib/python3.7/site-packages/asyncpg/connect_utils.py", line 655, in _connect                                                                                       
    api_1  |     connection_class=connection_class)                                                                                                                                                
    api_1  |   File "/usr/local/lib/python3.7/site-packages/asyncpg/connect_utils.py", line 622, in _connect_addr                                                                                  
    api_1  |     connector, timeout=timeout)
    api_1  |   File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    api_1  |     return fut.result()
    api_1  |   File "uvloop/loop.pyx", line 1914, in create_connection
    api_1  | socket.gaierror: [Errno -3] Temporary failure in name resolution
    
    api_1  | ERROR:    Application startup failed. Exiting.
    db_1   | syncing data to disk ... initdb: warning: enabling "trust" authentication for local connections
    db_1   | You can change this by editing pg_hba.conf or using the option -A, or
    db_1   | --auth-local and --auth-host, the next time you run initdb.
    

    stack trace of the error. Any solutions?

    opened by codehia 0
Owner
prostomarkeloff
Author of VKWave and lots of other libraries.. Python/Rust dev
prostomarkeloff
Backend Skeleton using FastAPI and Sqlalchemy ORM

Backend API Skeleton Based on @tiangolo's full stack postgres template, with some things added, some things removed, and some things changed. This is

David Montague 18 Oct 31, 2022
a lightweight web framework based on fastapi

start-fastapi Version 2021, based on FastAPI, an easy-to-use web app developed upon Starlette Framework Version 2020 中文文档 Requirements python 3.6+ (fo

HiKari 71 Dec 30, 2022
api versioning for fastapi web applications

fastapi-versioning api versioning for fastapi web applications Installation pip install fastapi-versioning Examples from fastapi import FastAPI from f

Dean Way 472 Jan 2, 2023
更新 2.0 版本,使用 Python WEB 高性能异步框架 FastAPI 制作的抖音无水印解析下载,采用前后端分离思想!

前言 这个是 2.0 版本,使用现在流行的前后端分离思想重构。 体验网址:https://douyin.bigdataboy.cn 更新日志 2020.05.30:使用 FastAPI 前后端分离重构 2020.05.02:已更新,正常使用 2020.04.27:抖音结构更新,已修复视频有水印。(失

null 64 Nov 25, 2022
sample web application built with FastAPI + uvicorn

SPARKY Sample web application built with FastAPI & Python 3.8 shows simple Flask-like structure with a Bootstrap template index.html also has a backgr

mrx 21 Jan 3, 2022
JSON-RPC server based on fastapi

Description JSON-RPC server based on fastapi: https://fastapi.tiangolo.com Motivation Autogenerated OpenAPI and Swagger (thanks to fastapi) for JSON-R

null 199 Dec 30, 2022
A Jupyter server based on FastAPI (Experimental)

jupyverse is experimental and should not be used in place of jupyter-server, which is the official Jupyter server.

Jupyter Server 122 Dec 27, 2022
ASGI middleware for authentication, rate limiting, and building CRUD endpoints.

Piccolo API Utilities for easily exposing Piccolo models as REST endpoints in ASGI apps, such as Starlette and FastAPI. Includes a bunch of useful ASG

null 81 Dec 9, 2022
python template private service

Template for private python service This is a cookiecutter template for an internal REST API service, written in Python, inspired by layout-golang. Th

UrvanovCompany 15 Oct 2, 2022
Backend, modern REST API for obtaining match and odds data crawled from multiple sites. Using FastAPI, MongoDB as database, Motor as async MongoDB client, Scrapy as crawler and Docker.

Introduction Apiestas is a project composed of a backend powered by the awesome framework FastAPI and a crawler powered by Scrapy. This project has fo

Fran Lozano 54 Dec 13, 2022
Minimal example utilizing fastapi and celery with RabbitMQ for task queue, Redis for celery backend and flower for monitoring the celery tasks.

FastAPI with Celery Minimal example utilizing FastAPI and Celery with RabbitMQ for task queue, Redis for Celery backend and flower for monitoring the

Grega Vrbančič 371 Jan 1, 2023
Example app using FastAPI and JWT

FastAPI-Auth Example app using FastAPI and JWT virtualenv -p python3 venv source venv/bin/activate pip3 install -r requirements.txt mv config.yaml.exa

Sander 28 Oct 25, 2022
A simple docker-compose app for orchestrating a fastapi application, a celery queue with rabbitmq(broker) and redis(backend)

fastapi - celery - rabbitmq - redis -> Docker A simple docker-compose app for orchestrating a fastapi application, a celery queue with rabbitmq(broker

Kartheekasasanka Kaipa 83 Dec 19, 2022
Ready-to-use and customizable users management for FastAPI

FastAPI Users Ready-to-use and customizable users management for FastAPI Documentation: https://frankie567.github.io/fastapi-users/ Source Code: https

François Voron 2.4k Jan 1, 2023
TODO aplication made with Python's FastAPI framework and Hexagonal Architecture

FastAPI Todolist Description Todolist aplication made with Python's FastAPI framework and Hexagonal Architecture. This is a test repository for the pu

Giovanni Armane 91 Dec 31, 2022
A rate limiter for Starlette and FastAPI

SlowApi A rate limiting library for Starlette and FastAPI adapted from flask-limiter. Note: this is alpha quality code still, the API may change, and

Laurent Savaete 565 Jan 2, 2023
Deploy an inference API on AWS (EC2) using FastAPI Docker and Github Actions

Deploy an inference API on AWS (EC2) using FastAPI Docker and Github Actions To learn more about this project: medium blog post The goal of this proje

Ahmed BESBES 60 Dec 17, 2022
REST API with FastAPI and SQLite3.

REST API with FastAPI and SQLite3

Luis Quiñones Requelme 2 Mar 14, 2022
Example of using FastAPI and MongoDB database.

FastAPI Todo Application Example of using FastAPI and MangoDB database. ?? Prerequisites Python ⚙️ Build & Run The first thing to do is to clone the r

Bobynets Ivan 1 Oct 29, 2021