An E-commerce backend application built with Django and Django REST Framework. It provides key functionalities, including product catalog and search, shopping cart operations, order processing, payment gateway integration, and JWT-based authentication, all accessible via RESTful APIs.
- ⚙️ Features
- 🚀 Installation
- ✅ Running Tests
- 🛠️ Tech Stack
-
🔐 Authentication
-
🔎 Products
- Hierarchical categories with flexible filtering and sorting
- Price range and keyword search
- Efficient product pagination for large catalogs
-
🛒 Cart management
- Add, remove, and update items in the shopping cart
-
💳 Checkout system
- Order creation
- Invoice generation
- Order history tracking to view past orders
-
💸 Payments
- Integrates with Zibal payment gateway for secure checkout
- Build and start containers
docker compose up --build
- Access the backend
- API:
http://localhost:9000/
- Admin:
http://localhost:9000/admin/
- API:
- Stop containers
docker compose down
- (Optional) Seed the database with demo data
Run this command inside your project directory:
docker compose exec web python manage.py seed_data
The backend is tested with pytest-django, ensuring robust integration test coverage across models, serializers, and API endpoints
pytest -v -x
-v
: Verbose output (show more details)-x
: Stop after the first failure
pytest app-name
Example:
pytest users -v
pytest app-name/tests/test_file_name::class/function_name
Examples:
pytest users/tests/test_models.py -v
pytest users/tests/test_models.py::test_user_registration -v
- Django: Web framework for building the backend
- Django Rest Framework: Toolkit for building RESTful APIs
- Djoser: REST implementation of Django's authentication system
- drf-yasg: Automated generation of Swagger/OpenAPI documentation