All Projects → leosussan → Fastapi Gino Arq Uvicorn

leosussan / Fastapi Gino Arq Uvicorn

Licence: mit
High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (w/ Redis and PostgreSQL).

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Fastapi Gino Arq Uvicorn

Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+19305.88%)
Mutual labels:  api, rest, swagger, openapi3, async, asyncio
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+1590.2%)
Mutual labels:  api, rest, swagger, openapi3
Compojure Api
Sweet web apis with Compojure & Swagger
Stars: ✭ 1,056 (+417.65%)
Mutual labels:  api, rest, swagger, async
Fastapi Crudrouter
A dynamic FastAPI router that automatically creates CRUD routes for your models
Stars: ✭ 159 (-22.06%)
Mutual labels:  api, rest, async, asyncio
Angular Swagger Ui
An angularJS implementation of Swagger UI
Stars: ✭ 131 (-35.78%)
Mutual labels:  api, swagger, openapi3
Swagger Inflector
Stars: ✭ 131 (-35.78%)
Mutual labels:  rest, swagger, openapi3
Subzero Starter Kit
Starter Kit and tooling for authoring GraphQL/REST API backends with subZero
Stars: ✭ 136 (-33.33%)
Mutual labels:  api, rest, postgresql
Core
The server component of API Platform: hypermedia and GraphQL APIs in minutes
Stars: ✭ 2,004 (+882.35%)
Mutual labels:  api, rest, swagger
Kaizen Openapi Editor
Eclipse Editor for the Swagger-OpenAPI Description Language
Stars: ✭ 97 (-52.45%)
Mutual labels:  rest, swagger, openapi3
Gemini
Model Driven REST framework to automatically generate CRUD APIs
Stars: ✭ 138 (-32.35%)
Mutual labels:  rest, swagger, postgresql
Swagger Js
Javascript library to connect to swagger-enabled APIs via browser or nodejs
Stars: ✭ 2,319 (+1036.76%)
Mutual labels:  rest, swagger, openapi3
Swagger Codegen
swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
Stars: ✭ 13,859 (+6693.63%)
Mutual labels:  rest, swagger, openapi3
Fastapi Plugins
FastAPI framework plugins
Stars: ✭ 104 (-49.02%)
Mutual labels:  openapi3, async, asyncio
Restful React
A consistent, declarative way of interacting with RESTful backends, featuring code-generation from Swagger and OpenAPI specs 🔥
Stars: ✭ 1,814 (+789.22%)
Mutual labels:  rest, swagger, openapi3
Tcases
A model-based test case generator
Stars: ✭ 103 (-49.51%)
Mutual labels:  api, rest, openapi3
Node Express Postgresql Sequelize
Node.js, Express.js, Sequelize.js and PostgreSQL RESTful API
Stars: ✭ 148 (-27.45%)
Mutual labels:  api, rest, postgresql
Hapi Openapi
Build design-driven apis with OpenAPI (formerly swagger) 2.0 and hapi.
Stars: ✭ 196 (-3.92%)
Mutual labels:  api, rest, swagger
Validator Badge
Validate your Swagger JSON/YAML today!
Stars: ✭ 158 (-22.55%)
Mutual labels:  rest, swagger, openapi3
Flama
🔥 Fire up your API with this flamethrower
Stars: ✭ 161 (-21.08%)
Mutual labels:  api, rest, swagger
Api Client Generator
Angular REST API client generator from Swagger YAML or JSON file with camel case settigs
Stars: ✭ 92 (-54.9%)
Mutual labels:  api, rest, swagger

fastapi-gino-arq-uvicorn

High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (powered by Redis & PostgreSQL).

Contents

Get Started

Setup

  1. Clone this Repository. git clone https://github.com/leosussan/fastapi-gino-arq-uvicorn.git
  2. Install Python 3.8 and poetry.
    • Recommended Method: asdf - a universal version manager (think nvm or pyenv)
      • Follow these instructions to install asdf.
      • Run the following commands from the project root:
        • asdf plugin add python
        • asdf plugin add poetry
        • asdf install -- will download & configure this project's Python + poetry setup
      • ~NOTE: your machine must have a system version of Python installed. If you don't, run the following: asdf install python 3.8.2 && asdf global python 3.8.2
    • If you have Python 3.8 and poetry installed already, please feel free to skip.
  3. Install dependencies (poetry install).
  4. Activate pre-commit hooks (in poetry shell, run pre-commit install).
  5. Make a copy of .dist.env, rename to .env. Fill in PostgreSQL, Redis, Sentry (optional) variables.
  6. Generate DB Migrations: in poetry shell, run alembic revision --autogenerate.
    • Apply migrations manually with alembic upgrade head.
    • If using the Dockerfile, migrations are applied at startup.

Run

Run Locally

NOTE: You must have PostgreSQL & Redis running locally.

  1. Make sure PostgreSQL & Redis are running locally.
  2. Run:
    • FastAPI Application:
      • For Active Development (w/ auto-reload): Run locally with poetry run task app
      • For Debugging (compatible w/ debuggers, no auto-reload): Configure debugger to run python app/main.py.
    • Background Task Worker:
      • For Active Development: Run poetry run task worker

Run Locally with Docker-Compose.

  1. Make sure Docker is running locally.
  2. Run poetry run task compose-up*.
    • Run poetry run task compose-down to spin down, clean up.

*app/settings/prestart.sh will run migrations for you before the app starts.

Build Your Application

  • Create routes in /app/routes, import & add them to the ROUTERS constant in /app/main.py
  • Create database models to /app/models/orm, add them to /app/models/orm/migrations/env.py for migrations
  • Create pydantic models in /app/models/pydantic
  • Store complex db queries in /app/models/orm/queries
  • Store complex tasks in app/tasks.
  • Add / edit globals to /.env, expose & import them from /app/settings/globals.py
    • Use any coroutine as a background function: store a reference in the ARQ_BACKGROUND_FUNCTIONS env.
    • Set SENTRY_DSN in your environment to enable Sentry.
  • Define code to run before launch (migrations, setup, etc) in /app/settings/prestart.sh

Features

Core Dependencies

  • FastAPI: touts performance on-par with NodeJS & Go + automatic Swagger + ReDoc generation.
  • GINO: built on SQLAlchemy core. Lightweight, simple, asynchronous ORM for PostgreSQL.
  • Arq: Asyncio + Redis = fast, resource-light job queuing & RPC.
  • Uvicorn: Lightning-fast, asynchronous ASGI server.
  • Optimized Dockerfile: Optimized Dockerfile for ASGI applications, from https://github.com/tiangolo/uvicorn-gunicorn-docker.

Additional Dependencies

  • PostgreSQL: Robust, fully-featured, scalable, open-source.
  • Redis: Fast, simple, broker for the Arq task queue.
  • Pydantic: Core to FastAPI. Define how data should be in pure, canonical python; validate it with pydantic.
  • Alembic: Handles database migrations. Compatible with GINO.
  • SQLAlchemy_Utils: Provides essential handles & datatypes. Compatible with GINO.
  • Sentry: Open-source, cloud-hosted error + event monitoring.
  • Pre-Commit: automatic formatting (black + isort) and linting (flake8).
  • Taskipy: Small, flexible task runner for Poetry.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].