Skip to content

alireza-v/EcomDjangoAPI

Repository files navigation

CortextCommerce

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.


Table of Contents


Features

  • 🔐 Authentication

    • Secure login and registration using Djoser and SimpleJWT
    • Supports password reset and user profile updates
  • 🔎 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

Installation Guide

🐳 Run with Docker

  1. Build and start containers
    docker compose up --build
  2. Access the backend
    • API: http://localhost:9000/
    • Admin: http://localhost:9000/admin/
  3. Stop containers
    docker compose down
  4. (Optional) Seed the database with demo data Run this command inside your project directory:
    docker compose exec web python manage.py seed_data

Running Tests

The backend is tested with pytest-django, ensuring robust integration test coverage across models, serializers, and API endpoints

Run all tests

pytest -v -x
  • -v: Verbose output (show more details)
  • -x: Stop after the first failure

Run tests for a specific app

pytest app-name

Example:

pytest users -v

Run tests for a specific file, class/function

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

Stacks

  • 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

About

Minimal ecommerce site using Django and Django Rest Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages