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 0.8.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 0.8.6
File Size Uploaded Provenance Actions
fastapi-crudrouter-0.8.6.tar.gz 12.3 kB Without provenance Details for fastapi-crudrouter-0.8.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-crudrouter 0.8.6
File Interpreter ABI Platform Actions
fastapi_crudrouter-0.8.6-py3-none-any.whl Python 3 none any Details for fastapi_crudrouter-0.8.6-py3-none-any.whl

Total release size: 28.6 kB

Release files / fastapi-crudrouter-0.8.6.tar.gz

Download URL fastapi-crudrouter-0.8.6.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
32704a7aa1d0b23bb6437f717599e9c4c01d8e5a91370a0359837a899a809ceb
BLAKE2b-256 checksum
How to use checksums
20f0236c71f45d908f7eff879d9002b23449c7c02bd815856ff8e238cbc008e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / fastapi_crudrouter-0.8.6-py3-none-any.whl

Download URL fastapi_crudrouter-0.8.6-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ceb0289cd7b7c687f88581838c032cdb21f24d36971e54b0e594ddcfaf9634e
BLAKE2b-256 checksum
How to use checksums
550c68fe05b1b77fa2d71c44228028acab50d1ccfcd7dd5dd21913da33182375
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Security for fastapi-crudrouter 0.8.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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