Headless e-commerce framework for Django

dinoperovic

Dino Perovic

Posted on September 16, 2020

Headless e-commerce framework for Django

Whilst moving to the headless way of building the web I encountered the dilema β€” which solution to use to build e-commerce stores in Django?

I wanted a simple yet flexible system that focuses on the headless RESTful approach and while there are many solutions in the wild, each had me reading through the docs and code for hours trying to figure out where to start, how to extend, how to integrate with existent projects, etc.

Don't get me wrong, there are some excellent fully-featured solutions, but none of them were simple...at least not for me :)

Creating my own

In comes Salesman. I've created a small framework for building headless e-commerce. The idea was to make it as simple as possible for a beginner Django developer to pick up and get started, but also allow for advanced features to be added progressively.

The one and only requirement for this project is Django REST Framework.

Features

  • API endpoints for Basket, Checkout and Order
  • Support for as many Product types needed using generic relations
  • Pluggable Modifier system for basket processing
  • Payment methods interface to support any gateway necessary
  • Customizable Order model
  • Wagtail and Django admin implementation

Try it!

Salesman uses Poetry for virtualenv and dependency management so you should install it first.

Clone the repo

git clone https://github.com/dinoperovic/django-salesman.git
Enter fullscreen mode Exit fullscreen mode

Run the example

cd django-salesman/
poetry install -E example
poetry run example/manage.py migrate
poetry run example/manage.py create_dummy_products
poetry run example/manage.py createsuperuser
poetry run example/manage.py runserver
Enter fullscreen mode Exit fullscreen mode

Done! You can now:

  • Navigate to /api/ and start adding products to the basket and purchase items using The Browsable API.
  • View orders in both the regular Django admin (/admin/) or Wagtail cms (/cms/).

You can find the full documentation on Read the Docs.


What are your experiences with building e-commerce in Django?

πŸ’– πŸ’ͺ πŸ™… 🚩
dinoperovic
Dino Perovic

Posted on September 16, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related