# Django eCommerce API with Redis JWT Celery Smart Search
A scalable, modular, and performant eCommerce REST API built with Django and Django REST Framework. Features include JWT authentication, Stripe integration, Redis caching, Celery tasks, real-time chat with Django Channels, personalized search, tagging, and more.
- Features
- Tech Stack
- Project Structure
- Getting Started
- API Documentation
- Environment Variables
- Endpoints Overview
- Testing
- License
- 🔐 User registration, login/logout, and JWT auth
- 🛍️ Product catalog, categories, tagging, search
- 🧺 Cart and order management
- 💳 Stripe payment integration
- 🧾 Coupon and discount system
- 📦 Order history and tracking
- 🔄 Background task scheduling (Celery + Redis)
- 📡 Real-time chat (Django Channels)
- 📬 Email notifications
- 📄 Auto-generated OpenAPI/Swagger docs
- 🐳 Docker support (optional)
- Backend: Django, Django REST Framework
- Auth: JWT, Google OAuth2 (social-auth)
- Database: PostgreSQL (configurable)
- Caching/Queue: Redis
- Background Tasks: Celery
- Payments: Stripe API
- Docs: drf-spectacular (OpenAPI/Swagger/Redoc)
- Containerization: Docker & Docker Compose (optional)
apps/
├── accounts/ → User auth, profiles
├── products/ → Products, categories, tags, search
├── orders/ → Order creation, history, cart
├── payments/ → Stripe integration & webhook
├── chat/ → Real-time chat via Channels
├── core/ → Shared utils, settings
- Python 3.10+
- PostgreSQL
- Redis
- React.js (for frontend, optional)
pipenv
orpip
# 1. Clone the repo
git clone https://github.com/YOUR_USERNAME/hypex-ecommerce-api.git
cd hypex-ecommerce-api
# 2. Create virtual env & install deps
pip install -r requirements.txt
# 3. Configure your environment variables
cp .env.example .env # then edit with your secrets
# 4. Apply migrations
python manage.py migrate
# 5. Create superuser
python manage.py createsuperuser
# 6. Start Redis & Celery (in separate terminals)
redis-server
celery -A ecommerce_api worker -l info
# 7. Start development server
python manage.py runserver
- Swagger UI: http://localhost:8000/api/schema/swagger-ui/
- Redoc: http://localhost:8000/api/schema/redoc/
Set these in .env
:
SECRET_KEY=your_secret
DATABASE_URL=postgres://user:pass@localhost:5432/dbname
REDIS_HOST=localhost
REDIS_PORT=6379
EMAIL_HOST_USER=your@email.com
EMAIL_HOST_PASSWORD=password
DEFAULT_FROM_EMAIL=noreply@yourdomain.com
STRIPE_PUBLISHABLE_KEY=...
STRIPE_SECRET_KEY=...
STRIPE_WEBHOOK_SECRET=...
GOOGLE_OAUTH2_KEY=...
GOOGLE_OAUTH2_SECRET=...
DOMAIN=localhost
SITE_NAME=Hypex
Method | Endpoint | Description |
---|---|---|
GET | /auth/me/ |
Get current user profile |
PUT | /auth/me/ |
Update user profile |
PATCH | /auth/me/ |
Partial update |
DELETE | /auth/me/ |
Delete user |
POST | /auth/reset-password/ |
Request password reset |
POST | /auth/reset-password-confirm/ |
Confirm reset token |
POST | /auth/set-password/ |
Set new password |
Method | Endpoint | Description |
---|---|---|
POST | /auth/register/ |
Register a new user |
POST | /auth/activate/ |
Activate account |
POST | /auth/token/create/ |
Login |
POST | /auth/token/refresh/ |
Refresh JWT token |
POST | /auth/token/verify/ |
Verify token |
POST | /auth/token/destroy/ |
Logout |
Method | Endpoint | Description |
---|---|---|
GET | /api/v1/products/ |
List all products |
POST | /api/v1/products/ |
Create a new product |
GET | /api/v1/products/{slug}/ |
Retrieve product |
PUT | /api/v1/products/{slug}/ |
Update product |
PATCH | /api/v1/products/{slug}/ |
Partial update |
DELETE | /api/v1/products/{slug}/ |
Delete product |
GET | /api/v1/products/user-products/ |
User's own listings |
Method | Endpoint |
---|---|
GET | /api/v1/categories/ |
POST | /api/v1/categories/ |
GET | /api/v1/categories/{slug}/ |
PUT | /api/v1/categories/{slug}/ |
PATCH | /api/v1/categories/{slug}/ |
DELETE | /api/v1/categories/{slug}/ |
Method | Endpoint |
---|---|
GET | /api/v1/cart/ |
POST | /api/v1/cart/{product_id}/add/ |
DELETE | /api/v1/cart/{product_id}/remove/ |
Method | Endpoint |
---|---|
GET | /api/v1/orders/ |
POST | /api/v1/orders/ |
GET | /api/v1/orders/{order_id}/ |
PUT | /api/v1/orders/{order_id}/ |
PATCH | /api/v1/orders/{order_id}/ |
DELETE | /api/v1/orders/{order_id}/ |
Method | Endpoint |
---|---|
GET | /api/v1/coupon/ |
POST | /api/v1/coupon/ |
GET | /api/v1/coupon/{id}/ |
PUT | /api/v1/coupon/{id}/ |
PATCH | /api/v1/coupon/{id}/ |
DELETE | /api/v1/coupon/{id}/ |
POST | /api/v1/coupon/apply-coupon/ |
Method | Endpoint |
---|---|
POST | /payment/process/{order_id}/ |
GET | /payment/completed/ |
GET | /payment/canceled/ |
Method | Endpoint |
---|---|
GET | /api/v1/chat/{product_id}/ |
python manage.py test
This project is licensed under the MIT License. See the LICENSE file for details.
Let me know if you want to add Docker setup, deployment notes (Heroku, Railway, etc.), or include a logo/banner at the top!
Made by [Yousef M. Y. Al Sabbah] – Reach out via [yalsabbah@students.iugaza.edu.ps] or open an issue on GitHub.
Tip: Use Postman or Insomnia to explore the API endpoints quickly during development.