Extensions

A list of Sanic extensions created by the community.

Extension and Plugin Development

  • Sanic-Plugins-Framework: Library for easily creating and using Sanic plugins.

  • sanic-script: An extension for Sanic that adds support for writing commands to your application.

Security

  • Sanic JWT: Authentication, JWT, and permission scoping for Sanic.

  • Secure: Secure 🔒 is a lightweight package that adds optional security headers and cookie attributes for Python web frameworks.

  • Sessions: Support for sessions. Allows using redis, memcache or an in memory store.

  • CORS: A port of flask-cors.

  • Sanic-JWT-Extended: Provides extended JWT support for

  • UserAgent: Add user_agent to request

  • Limiter: Rate limiting for sanic.

  • sanic-oauth: OAuth Library with many provider and OAuth1/OAuth2 support.

  • Sanic-Auth: A minimal backend agnostic session-based user authentication mechanism for Sanic.

  • Sanic-CookieSession: A client-side only, cookie-based session, similar to the built-in session in Flask.

Documentation

  • OpenAPI/Swagger: OpenAPI support, plus a Swagger UI.

  • Sanic-RestPlus: A port of Flask-RestPlus for Sanic. Full-featured REST API with SwaggerUI generation.

  • sanic-transmute: A Sanic extension that generates APIs from python function and classes, and also generates Swagger UI/documentation automatically.

ORM and Database Integration

  • Motor: Simple motor wrapper.

  • Sanic CRUD: CRUD REST API generation with peewee models.

  • sanic-graphql: GraphQL integration with Sanic

  • GINO: An asyncio ORM on top of SQLAlchemy core, delivered with a Sanic extension. (Documentation)

  • Databases: Async database access for SQLAlchemy core, with support for PostgreSQL, MySQL, and SQLite.

Unit Testing

  • pytest-sanic: A pytest plugin for Sanic. It helps you to test your code asynchronously.

Project Creation Template

  • cookiecutter-sanic: Get your sanic application up and running in a matter of second in a well defined project structure. Batteries included for deployment, unit testing, automated release management and changelog generation.

Templating

  • Sanic-WTF: Sanic-WTF makes using WTForms with Sanic and CSRF (Cross-Site Request Forgery) protection a little bit easier.

  • Jinja2: Support for Jinja2 template.

  • jinja2-sanic: a jinja2 template renderer for Sanic.(Documentation)

API Helper Utilities

i18n/l10n Support

  • Babel: Adds i18n/l10n support to Sanic applications with the help of the Babel library

Custom Middlewares

  • Dispatch: A dispatcher inspired by DispatcherMiddleware in werkzeug. Can act as a Sanic-to-WSGI adapter.

Monitoring and Reporting

  • sanic-prometheus: Prometheus metrics for Sanic

  • sanic-zipkin: Easily report request/function/RPC traces to zipkin/jaeger, through aiozipkin.

Sample Applications