Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/awtkns/fastapi-crudrouter
A dynamic FastAPI router that automatically creates CRUD routes for your models
https://github.com/awtkns/fastapi-crudrouter
api async asyncio code-generation crud crud-routes fastapi fastapi-crudrouter framework openapi openapi-route python python3 redoc rest sql swagger-ui web
Last synced: 28 days ago
JSON representation
A dynamic FastAPI router that automatically creates CRUD routes for your models
- Host: GitHub
- URL: https://github.com/awtkns/fastapi-crudrouter
- Owner: awtkns
- License: mit
- Created: 2020-12-19T20:58:44.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-01T12:10:38.000Z (about 1 year ago)
- Last Synced: 2024-09-29T02:21:20.970Z (about 1 month ago)
- Topics: api, async, asyncio, code-generation, crud, crud-routes, fastapi, fastapi-crudrouter, framework, openapi, openapi-route, python, python3, redoc, rest, sql, swagger-ui, web
- Language: Python
- Homepage: https://fastapi-crudrouter.awtkns.com
- Size: 1.3 MB
- Stars: 1,381
- Watchers: 15
- Forks: 155
- Open Issues: 66
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-fastapi - FastAPI CRUDRouter - A FastAPI router that automatically creates and documents CRUD routes for your models. (Third-Party Extensions / Utils)
- awesome-fastapi - :octocat: fastapi-crudrouter :star: 800+ :fork_and_knife: 100+ - A dynamic FastAPI router that automatically creates CRUD routes for your models. (APIs)
- awesome-fastapi - FastAPI CRUDRouter - A FastAPI router that automatically creates and documents CRUD routes for your models. (Third-Party Extensions / Utils)
README
⚡ Create CRUD routes with lighting speed ⚡
A dynamic FastAPI router that automatically creates CRUD routes for your models
---
**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](https://github.com/awtkns/fastapi-crudrouter) has your back. As an
extension to the APIRouter included with [FastAPI](https://fastapi.tiangolo.com/), 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
```bash
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](https://fastapi-crudrouter.awtkns.com/routing).```python
from pydantic import BaseModel
from fastapi import FastAPI
from fastapi_crudrouter import MemoryCRUDRouter as CRUDRouterclass Potato(BaseModel):
id: int
color: str
mass: floatapp = 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](https://fastapi-crudrouter.awtkns.com/pagination/))
- Ability to Provide Custom Create and Update Schemas ([docs](https://fastapi-crudrouter.awtkns.com/schemas/))
- Dynamic Generation of Create and Update Schemas ([docs](https://fastapi-crudrouter.awtkns.com/schemas/))
- Ability to Add, Customize, or Disable Specific Routes ([docs](https://fastapi-crudrouter.awtkns.com/routing/))
- Native Support for FastAPI Dependency Injection ([docs](https://fastapi-crudrouter.awtkns.com/dependencies/))## 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](https://fastapi-crudrouter.awtkns.com/backends/memory/))
- SQLAlchemy ([docs](https://fastapi-crudrouter.awtkns.com/backends/sqlalchemy/))
- Databases (async) ([docs](https://fastapi-crudrouter.awtkns.com/backends/async/))
- Gino (async) ([docs](https://fastapi-crudrouter.awtkns.com/backends/gino.html))
- Ormar (async) ([docs](https://fastapi-crudrouter.awtkns.com/backends/ormar/))
- Tortoise ORM (async) ([docs](https://fastapi-crudrouter.awtkns.com/backends/tortoise/))## 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](https://raw.githubusercontent.com/awtkns/fastapi-crudrouter/master/docs/en/docs/assets/RouteOverview.png)
The CRUDRouter is able to dynamically generate detailed documentation based on the models given to it.
![OpenAPI Route Detail](https://raw.githubusercontent.com/awtkns/fastapi-crudrouter/master/docs/en/docs/assets/RouteDetail.png)