Skip to main content

⚡ Create CRUD routes with lighting speed ⚡
A dynamic FastAPI router that automatically creates CRUD routes for your models

Tests Downloads Package version License

PyPI - Python Version


Documentation: https://fastapi-crudrouter.awtkns.com

Source Code: https://github.com/awtkns/fastapi-crudrouter


Tired of rewriting generic CRUD routes? Need to rapidly prototype a feature for a presentation or a hackathon? Thankfully, fastapi-crudrouter has your back. As an extension to the APIRouter included with FastAPI, the FastAPI CRUDRouter will automatically generate and document your CRUD routes for you, all you have to do is pass your model and maybe your database connection.

FastAPI-CRUDRouter is lighting fast, well tested, and production ready.

Installation

pip install fastapi-crudrouter

Basic Usage

Below is a simple example of what the CRUDRouter can do. In just ten lines of code, you can generate all the crud routes you need for any model. A full list of the routes generated can be found here.

from pydantic import BaseModel
from fastapi import FastAPI
from fastapi_crudrouter import MemoryCRUDRouter as CRUDRouter

class Potato(BaseModel):
    id: int
    color: str
    mass: float

app = FastAPI()
app.include_router(CRUDRouter(schema=Potato))

Advanced Usage

fastapi-crudrouter provides a number of features that allow you to get the most out of your automatically generated CRUD routes. Listed below are some highlights.

  • Automatic Pagination (docs)
  • Ability to Provide Custom Create and Update Schemas (docs)
  • Dynamic Generation of Create and Update Schemas (docs)
  • Ability to Add, Customize, or Disable Specific Routes (docs)
  • Native Support for FastAPI Dependency Injection (docs)

Supported Backends / ORMs

fastapi-crudrouter currently supports a number of backends / ORMs. Listed below are the backends currently supported. This list will likely grow in future releases.

  • In Memory (docs)
  • SQLAlchemy (docs)
  • Databases (async) (docs)
  • Gino (async) (docs)
  • Ormar (async) (docs)
  • Tortoise ORM (async) (docs)

OpenAPI Support

By default, all routes generated by the CRUDRouter will be documented according to OpenAPI spec.

Below are the default routes created by the CRUDRouter shown in the generated OpenAPI documentation.

OpenAPI Route Overview

The CRUDRouter is able to dynamically generate detailed documentation based on the models given to it.

OpenAPI Route Detail

Metadata

Release files for fastapi-crudrouter-v2 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastapi-crudrouter-v2 0.1.6
File Size Uploaded
fastapi_crudrouter_v2-0.1.6.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-crudrouter-v2 0.1.6
File Interpreter ABI Platform
fastapi_crudrouter_v2-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / fastapi_crudrouter_v2-0.1.6.tar.gz

Download URL fastapi_crudrouter_v2-0.1.6.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fad9e5ff1c98a8b5b998c78615c3bddb75d6c33ae56c58765e0d981295f92e92
BLAKE2b-256 checksum
How to use checksums
4985bf5b220570dbb1be7fb344c11e479fc37b668a6733c8fa0950272f963e8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.12.10 Windows/11

Release files / fastapi_crudrouter_v2-0.1.6-py3-none-any.whl

Download URL fastapi_crudrouter_v2-0.1.6-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92d3818a089a009b69d3df58e6cd6f811b20a30a8dea39d9697886efa2ed6c3f
BLAKE2b-256 checksum
How to use checksums
7149ae849a26f511b9b317b6b44c4aa90804a0ffd275eff5dc954c35f1fc53bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.12.10 Windows/11

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page