This is a full stack e-commerce application that I have been building in my spare time. It has many built in features I find myself reimplementing every time I want to prototype an experimental product.
Although my passion is to learn how machine learning and artificial intelligence can improve user experience and engagement, it is crucial to understand how that part fits into a monstrously complicated system. I wanted this project to be a simple template for any such experimentation with ML models.
Attempting to keep my promise of simplicity, I decided that Django would be a good option for the back end due to its incredible versatility and developer experience. The Django admin is the perfect interface to modify and use due to its proximity to the database. But the purpose of admin panel isin't merely to display tables. The admin templates are infinitely customizable, so one could add custom analytics, graphs models to any page, using the same tools they would in python.
For the front end, I used React with Next JS. Coming from a create-react-app background, server side rendering with React was new to me. But it had one advantage that really attracted me. Most e-commerce websites share a common flaw. They are slow. This is because the server has to load all the content as well as any additional API calls and 3rd party scripts the page requires every time the user clicks on a new link. This flaw, mainly due to legacy, and old codebases, is avoided in a very slick fashion with the static generation tool built into Next JS. This allows us to edit whatever products we want to in Django admin and re generate the website. The remaining API calls are very minimal.
This method, however, is not ideal for everyone. This approach only works if our products don't constantly change. That is, the website only has to re render once an hour, or day, or so.
git clone https://github.com/oyavuzjr/Django-Nextjs-Ecommerce-Boilerplate
cd Django-Nextjs-Ecommerce-Boilerplate
python --version
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
cd REACT
npm install
API_ENDPOINT="http://localhost:8000/api/"
IMAGE_ENDPOINT="http://localhost:8000/_next"
GA_TRACKING_ID="..."
npm run build
.env