E-Commerce REST API built with Django REST Framework as a learning project. The API supports full shopping flow from browsing products to placing orders.
- Python 3.13
- Django 5.2
- Django REST Framework
- JWT Authentication (SimpleJWT)
- django-filter
- Register & Login with JWT Tokens
- Products with Search, Filter by price, and Pagination
- Cart Management (each user sees only their cart)
- Orders with automatic Stock Management
- Reviews & Ratings (one review per product per user)
- Sales Statistics using Django ORM aggregations
- Custom Permissions (only owner can edit/delete their data)
# Install dependencies
pip install -r requirements.txt
# Run migrations
python manage.py migrate
# Create admin user
python manage.py createsuperuser
# Start server
python manage.py runserverPOST /api/register/ β Create new account
POST /api/token/ β Login and get JWT tokens
POST /api/token/refresh/ β Refresh access token
GET /api/product/ β List all products (with filter & search)
POST /api/product/ β Add new product
PUT /api/product/<id>/ β Update product
DELETE /api/product/<id>/ β Delete product
GET /api/cart/ β View my cart
POST /api/cart/ β Add item to cart
DELETE /api/cart/<id>/ β Remove item from cart
POST /api/order/ β Place an order
GET /api/order/ β View my orders
POST /api/review/ β Add a review
GET /api/review/ β View all reviews
GET /api/statistics/ β View sales statistics (admin)
GET /api/product/?search=iphone
GET /api/product/?min_price=100&max_price=500
GET /api/product/?ordering=-price
GET /api/product/?page=2
Made by Mahmoud Mancy