Skip to content

Muffin-REST documentation

Muffin-REST adds REST resources to Muffin. A handler declares a model or table in Meta; the library builds list and detail routes, query handling, validation, and an OpenAPI spec around it.

The docs are split by the question you are trying to answer.

Start here

Reference

  • Querying: where, sort, limit, offset, field selection.
  • Schemas: generated schemas, validation, custom fields.
  • OpenAPI: spec generation, docstrings, authorization.
  • Errors: error bodies and status codes.
  • API reference: classes, options, and hook signatures.

Practice

  • Cookbook: auth, scoping, soft delete, custom filters, file upload, tests.
  • Development: local setup, tests, examples, release.

How the pieces fit

Application
└── API                 routing, auth, OpenAPI
    └── RESTHandler     request lifecycle, CRUD, query handling
        ├── PWRESTHandler
        ├── SARESTHandler
        └── MongoRESTHandler

API owns the router and the authorization callback. A RESTHandler subclass owns one resource. Backend handlers implement the storage-specific parts: loading a collection, loading one resource, pagination, saving, and deleting.

The core is muffin_rest.handler.RESTBase. Read it once; every guide refers to its hooks.