$ show thomas545/ecommerce_api
This is a Django REST Framework-based ecommerce API that provides typical ecommerce functionality: user authentication (JWT, social login via allauth), product CRUD with hierarchical categories, shopping cart, checkout, order management, real-time notifications via WebSockets and FCM, chat via Django Channels, SMS verification via Twilio, and product search via Elasticsearch (partially configured with both Haystack and elasticsearch-dsl). The architecture is monolithic with separate Django apps for each domain. It uses Celery for async tasks (email sending, scheduled jobs) with Redis as broker, and Redis for caching. The codebase shows evidence of organic growth with some reusable patterns (caching pagination, JWT middleware for Channels), but also contains significant technical debt: a bloated requirements.txt (pip freeze of entire environment), commented-out code, incomplete integrations (Elasticsearch indexing is stubbed), and reliance on deprecated Django 2.2 APIs (ugettext_lazy). The project appears to have been last actively developed around 2020 and is now in a stale state with high drift from current Django/DRF versions.
The LLM identified 3 files worth highlighting for reuse:
Implements two custom paginator classes (FastQuerysetPaginator and FastObjectPaginator) that cache the primary key list and count of a queryset using Django's cache framework, reducing database queries for subsequent pagination requests. The FastPaginator factory class dispatches to the appropriate implementation based on whether the input is a QuerySet or a list. This is a self-contained, extractable pattern for improving pagination performance in any Django REST Framework project that uses caching.
A Django Channels middleware that extracts a JWT token from the WebSocket handshake headers, validates it using DRF's JWT serializer, and sets the authenticated user on the scope. This is a concise, reusable component for adding JWT authentication to any Channels-based WebSocket application, completely decoupled from business logic.
A utility function that sends a notification to a user via both Firebase Cloud Messaging (FCM) and Django Channels WebSocket group. It creates a Notification model instance, serializes it, pushes to the user's WebSocket group, and sends an FCM message to all registered devices. This demonstrates a clean, reusable pattern for implementing multi-channel push notifications that can be triggered from anywhere in the codebase.