Skip to content

shodown96/djr-ecommerce

Repository files navigation

Django + React Ecommerce (Distributed Architecture)

This repository contains an ecommerce application built with Django and React, extended with a distributed, event-driven backend architecture.

⚠️ This repository is an old project, re-purposed to showcase simple distributed architecture.

The backend uses Django REST Framework and is enhanced with:

  • Celery for background task processing
  • Redis for task buffering and caching
  • RabbitMQ as a domain event bus
  • Kombu for event publishing and consumption
  • Commands for seeding and running consumer threads

The frontend is built with React, Redux, and Tailwind.


Architecture Overview

  • Django handles HTTP requests and business logic
  • Redis buffers Celery tasks and caches frequently accessed data
  • Celery Workers execute background jobs (emails, image resizing, webhooks)
  • RabbitMQ publishes domain events (e.g. order.completed)
  • Event Consumers react to events and trigger async work
  • Idempotency prevents duplicate side effects during retries
  • Stripe & Paystack as payment gateways

Backend Setup

python -m venv .venv
source .venv/bin/activate
cd server
pip install -r requirements.txt
python manage.py runserver

# Seed products
python manage.py seed_products

Run Background Process

cd server
celery -A project worker -l info
python manage.py run_notifications_consumer

Run Backend Test

pytest

Frontend Development Workflow

Duplicate the .env.example file, rename the copy to .env and add your own stripe and paystack keys.

Then run the following

cd client
npm i
npm start

Docker (WIP)

Local (development)

# Merge environemnt variables
sh ./scripts/merge_envs.sh

# Run local stack
docker compose up --build

Production

# Build frontend
sh ./scripts/build_client.sh

# Merge environemnt variables
sh ./scripts/merge_envs.sh

# Run production stack
docker compose -f docker-compose.prod.yml up -d

About

A full-stack application built with Django and React, featuring a distributed, event-driven backend architecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors