--- id: django-ninja-extra version: "0.31.6" license: unclear license_treatment: permissive maintenance: active --- # django-ninja-extra — Django Ninja Extra - Class Based Utility and more for Django Ninja(Fast Django REST framework) License: permissive · Maintenance: active · Downloads: 408.9K/mo ## What it is and what it does Django Ninja Extra is a class-based extension for Django Ninja that organizes REST API endpoints into controller classes rather than scattered function decorators. It adds controller-level and route-level permission systems, built-in dependency injection via the injector package, and a service layer pattern for business logic separation. The package inherits Django Ninja's Pydantic-based validation, async support, and automatic OpenAPI documentation while layering on organizational patterns for larger APIs. You use it by decorating controller classes with @api_controller, defining handler methods with @http_get/@http_post/etc., and registering them with your NinjaExtraAPI instance. Dependencies are automatically resolved and injected into controller constructors. It supports custom permission classes at both controller and individual route levels, making it suitable for APIs with complex authorization requirements. The package maintains compatibility with Django versions 3.1 through 6.0 and Python 3.8 and later. Use it for: - Build modular REST APIs by grouping related endpoints into controller classes with shared dependencies and permissions. - Implement fine-grained permission control at both controller and individual route levels for complex authorization schemes. - Inject services and repositories into controllers for clean separation between API handlers and business logic. - Migrate from Django Ninja to a framework with familiar class-based patterns while retaining async-first performance. - Generate interactive API documentation automatically via OpenAPI/Swagger without manual schema definitions. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Django Ninja Extra extends Django Ninja with class-based controllers, advanced permissions, and dependency injection for building structured REST APIs. Yes. This is an actively maintained, permissive-licensed extension to Django Ninja with low install friction and no known vulnerabilities. Install it if you're building a Django REST API and prefer class-based organization with dependency injection; skip it if you're committed to function-based simplicity. ## Install pip install django-ninja-extra uv add django-ninja-extra poetry add django-ninja-extra ## Installing django-ninja-extra Before you install: Low friction: pure Python wheel with five runtime dependencies (Django, django-ninja, injector, asgiref, contextlib2). Actively maintained with a release 24 days ago and 594 repository stars. License in practice: MIT license (permissive) means you can use this freely in commercial and private projects with minimal restrictions. Quickstart: pip install django-ninja-extra # In settings.py INSTALLED_APPS = [..., 'django_ninja_extra'] # In api.py from django_ninja_extra import NinjaExtraAPI, api_controller, http_get api = NinjaExtraAPI() @api_controller('/math') class MathController: @http_get('/add') def add(self, a: int, b: int): return {"result": a + b} api.register_controllers(MathController) Verify before relying: - Whether the injector dependency works seamlessly with all Django versions listed (3.1 through 6.0) in practice. - Performance characteristics compared to Django alone when handling high request volumes. - Exact module import paths and whether 'ninja_extra' or 'django_ninja_extra' is the canonical import name. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 408.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django rest api class-based views, django ninja controllers, dependency injection django, django api permissions, async django rest framework, class-based-views, dependency-injection, async-first [View on SkillFed](https://skillfed.io/packages/django-ninja-extra) · [View on PyPI](https://pypi.org/project/django-ninja-extra/)