How ziauldin123/django-ecommerce-b2b2c works
Project type and purpose
• This is a monolithic full-stack Django E-commerce B2B2C platform (“SokoPark”) enabling multivendor retail and wholesale.
• The README confirms key features: multivendor shops, B2B/B2C flows, secure transactions, advanced search, order tracking, vendor admin, and scalability.
File structure
• Top-level “main” folder is the Django project (settings.py, urls.py, wsgi.py, asgi.py, s3utils.py).
• Under apps/ you have ~12 Django apps, each encapsulating a domain:
• blog (content)
• cart (shopping cart & payment orchestration)
• core (common templates, site pages)
• coupon (discount API)
• home (landing, static assets)
• maintenance (maintenance mode middleware & assets)
• newProduct, product (product catalog & variation logic)
• newsletter (email subscription API)
• ordering & order (order placement, notification templates)
• transporter (shipping partner integration)
• vendor (vendor profiles & dashboards)
• Configuration files: requirements.txt, .gitignore, LICENSE.
Key insights from README
• Stacks: Django (MTV), relational database (likely PostgreSQL/MySQL), AWS S3 for media (s3utils.py), SMTP for email, external payment providers via cart/services/payment_service.py.
• No mention of JavaScript SPA—pages served via Django templates.
Main components
a. Clients: Web browser (retailer/wholesaler/vendor/admin)
b. Network layer: optional CDN for static, Load Balancer/Nginx or Gunicorn
c. Application Layer: Django app (main WSGI/ASGI) subdivided into domain apps
d. Data Layer:
• Relational DB (PostgreSQL/MySQL)
• AWS S3 bucket for media/static
• Caching layer (Redis/Memcached) if in use or planned
e. External Services:
• Payment Gateway (e.g., Stripe, M-Pesa via payment_service.py)
• Email/SMS providers for notifications
Relationships & data flows
• Client → Load Balancer → Django (WSGI/ASGI) → URL dispatcher → App Views
• Views invoke:
– Template layer to render HTML (home, core, blog, product, ordering templates)
– Service layer (cart.services, product.services) for business logic
– Data layer (Django ORM) to read/write DB
• File uploads: Views → S3 via s3utils
• Payment: Views → Payment Service → External Payment API → callback → cart/order apps
• Notifications: order utilities → SMTP or SMS API → customer/vendor/transporter
• Static assets: served from CDN or Nginx directly (static/, media/)
Architectural patterns and design principles
• Django’s MTV (Model-Template-View) segregation per app
• Service layer within apps (services/ packages) for business logic, keeping views thin
• Templatetag / context processors for reusable UI logic
• Modular monolith: each domain in its own Django app
• Third-party integrations abstracted behind service modules