A production-grade e-commerce backend built with Django REST Framework, featuring JWT authentication, async task processing, caching, performance profiling, and load testing.
- Backend: Django 5.2, Django REST Framework
- Auth: JWT via
djangorestframework-simplejwt+ Djoser - Database: MySQL (prod) / SQLite (dev)
- Cache: Redis via
django-redis - Task Queue: Celery + Redis broker
- Search & Filtering:
django-filter, DRFSearchFilter,OrderingFilter - Performance: Django Silk (profiling), Django Debug Toolbar
- Load Testing: Locust
- Testing: pytest + pytest-django + model-bakery
- Static Files: WhiteNoise
- CORS:
django-cors-headers
- Product Catalog — CRUD with filtering by collection, price range, search, and ordering
- Collections — Hierarchical product categorization with product count annotations
- Cart System — Session-based carts with add/update/remove items
- Orders — Order creation from cart, order management with admin controls
- Customer Profiles —
/meendpoint, customer history with custom permissions - Product Images — Multi-image support per product
- Reviews — Nested reviews per product
- Likes — Generic content type-based likes system
- Tags — Generic tagging system via content types
- JWT Auth — Register, login, token refresh via Djoser
- Custom User Model — Extends
AbstractUserviacoreapp - Celery Beat — Scheduled background tasks
- Pagination — Default pagination on all list endpoints
- Permissions — Role-based:
AllowAnyfor reads,IsAdminUserfor writes
FirstDjangoProject/
├── core/ # Custom user model, serializers
├── store/ # Products, collections, carts, orders, reviews, images
├── tags/ # Generic tagging
├── likes/ # Generic likes
├── playground/ # Celery task experiments
├── locustfiles/ # Load test scripts
├── project1/
│ └── settings/
│ ├── common.py
│ ├── dev.py
│ └── prod.py
└── manage.py
# Clone
git clone https://github.com/gsvenkatsai/FirstDjangoProject.git
cd FirstDjangoProject
# Create and activate virtualenv
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Configure dev settings (create project1/settings/dev.py with SECRET_KEY, DB, Redis)
# Run migrations
python manage.py migrate
# Load fixtures (optional)
python manage.py loaddata fullstoredata.json
# Start server
python manage.py runserver# Worker
celery -A project1 worker --loglevel=info
# Beat scheduler
celery -A project1 beat --loglevel=info
# Flower monitoring
celery -A project1 flowerpytest
# Watch mode
ptwlocust -f locustfiles/browse_products.py| Resource | Endpoint |
|---|---|
| Products | /store/products/ |
| Collections | /store/collections/ |
| Cart | /store/carts/ |
| Cart Items | /store/carts/{id}/items/ |
| Orders | /store/orders/ |
| Customers | /store/customers/ |
| My Profile | /store/customers/me/ |
| Product Reviews | /store/products/{id}/reviews/ |
| Product Images | /store/products/{id}/images/ |
| Auth | /auth/users/, /auth/jwt/create/ |
SECRET_KEY = '...'
DEBUG = True
DATABASES = { 'default': { 'ENGINE': '...mysql...', 'NAME': '...', ... } }
CELERY_BROKER_URL = 'redis://localhost:6379/1'MIT