$ show Fueled/django-init
django-init is a cookiecutter template for generating Django-based REST API projects. It provides a comprehensive starting point with Django 4.1, Python 3.9, Poetry dependency management, Django REST Framework, and optional features like Celery, GraphQL, ASGI, Docker, and various deployment configurations. The template generates projects with custom user models, JWT authentication, proper API versioning, and testing setup. What distinguishes this template is the quality of its reusable components in the base/ directory, particularly the custom DRF mixins for multiple serializers and per-action permissions, specialized routers for singleton resources, and thoughtful exception handling and response classes that demonstrate deep understanding of Django REST Framework's architecture.
The LLM identified 6 files worth highlighting for reuse:
Contains MultipleSerializerMixin and PermissionPerActionMixin that allow DRF viewsets to use different serializer classes and permission classes per action. These mixins solve common API design problems by extending DRF's viewset mechanics in a clean, reusable way that could be dropped into any DRF project with minimal modification.
Implements custom LimitOffsetPagination and CursorPagination classes with thoughtful defaults and utility functions for consistent paginated responses. Addresses limitations of DRF's built-in pagination by providing flexible page size controls and proper cursor implementation that doesn't include count in responses (as appropriate for cursor pagination).
Defines SingletonRouter that maps all standard HTTP methods (GET, POST, PUT, PATCH, DELETE) to the same URL pattern for singleton resources like /me endpoints. Solves a common problem in REST API design where standard routers don't adequately handle resources that represent a single entity (like the current user) rather than a collection.
Provides a comprehensive exception handling system for DRF that creates consistent JSON error responses with proper field-level error details. Includes custom exception classes for common API scenarios and a sophisticated exception handler that formats errors according to best practices, making it easy to maintain consistent error responses across an API.
Extends DRF's Response class with semantic HTTP status code classes (Ok, Created, Accepted, etc.) that improve code readability and reduce magic numbers. Provides a more expressive way to return appropriate HTTP status codes while maintaining full compatibility with DRF's response handling.
Provides URL utilities for building absolute URLs that work with django-sites, including a resolve_frontend_url function that generates proper frontend URLs for password reset links and other cross-domain references. Solves the common problem of generating correct absolute URLs in multi-site Django deployments.