Skip to content

BetterCRUD

A better CRUD library for FastAPI.
FastAPI CRUD routing library based on class view, you can control everything

Tests PyPi Version Supported Python Versions


Documentation: https://bigrivi.github.io/better_crud/

Source Code: https://github.com/bigrivi/better_crud


BetterCRUD is a library that can quickly generate CRUD routes for you without any intrusion to your code. When you are troubled by a large number of repeated CRUD routes, it can help you save a lot of time and let you focus on your business logic.

BetterCRUD is reliable, fully tested, and used in project production environments.

You only need to configure some crud options and define your model to produce powerful CRUD functions

@crud(
    router,
    dto={
        "create": PetCreate,
        "update": PetUpdate
    },
    serialize={
        "base": PetPublic,
    },
    **other_options
)
class PetController():
    service: PetService = Depends(PetService)

Features

  • Fully Async, Synchronization is not supported
  • Less boilerplate code
  • Configuring static type support
  • More flexible custom configuration, Less invasive
  • Compatible with both class views and functional views
  • Rich filter, pagination, and sorting support
  • Automated relationship support, query and storage
  • Extensible custom backend

Default Routes

Route Method Description
/resource GET Get Many
/resource/{id} GET Get One
/resource POST Create One
/resource/bulk POST Create Many
/resource/{id} PUT Update One
/resource/{ids}/bulk PUT Update Many
/resource/{ids} DELETE Delete Many

Quick Start

Follow the Quick Start guide to set up your first BetterCRUD route in minutes — database setup, model definition, service, controller, and router registration, all with a working example.

OpenAPI Route Overview

⭐️ If you find BetterCRUD useful, you can contribute to its growth by giving it a star on GitHub

Credits

This project draws inspiration from the following frameworks:

License

MIT