How webwizard2965/django-shopping-website works
Project Type & Purpose
• This is a full-stack e-commerce web application.
• Backend: Django (with Django REST Framework-style serializers & views), SQLite (development), Stripe integrations.
• Frontend: React SPA using Redux for state management, served as static assets.
File Structure & Key Components
• Top-level: two main folders, backend and frontend.
• Backend “apps”:
• account (users, billing addresses, orders)
• payments (payment processing integrations)
• product (product catalog management)
• my_project (Django project settings, URLs, WSGI/ASGI)
• Frontend structure:
• public (index.html and manifest)
• src
– actions, reducers, store (Redux)
– components (UI building blocks)
– pages (routes/views)
– constants
• Config & deployment hints:
• backend/requirements.txt, backend/static/images
• frontend/package.json, .env (for production env vars)
Main Components
a. Client Layer
– Web Browser
– React SPA (served from a static file server or Django’s static endpoint)
– Redux store (client in-memory state)
b. API Layer
– React Axios/fetch calls ↔ Django REST API endpoints
– URL grouping by app (e.g., /api/account/, /api/product/, /api/payments/)
c. Backend Layer
– Django (WSGI/ASGI) application
– Django ORM (models in account/, product/, payments/)
– Business logic: serializers.py, views.py in each app
– Admin interface (Django Admin)
d. Data Layer
– Development: SQLite (db.sqlite3)
– Future/Production: PostgreSQL (per README upcoming)
e. External Services
– Stripe payment gateway (API calls from payments app)
Relationships & Data Flows
1. Browser → React App
2. React App → Redux store (dispatch actions)
3. React → REST API calls (using cardActions.js, productActions.js, userActions.js)
4. Django REST API → Django ORM → Database
5. Payments App → Stripe API
6. Django Admin UI → ORM → Database
Architectural Patterns & Design Principles
• Separation of concerns:
• Frontend (presentation + client-side state management)
• Backend (API + business logic + data persistence)
• Modular Django apps (account, product, payments) following the “app per domain” pattern.
• Redux unidirectional data flow on the client.
• RESTful API endpoints grouped by resource.
Technology Stack Highlights
• Django + Django REST Framework (serializers, viewsets)
• React (functional components + hooks) + Redux
• SQLite (dev) / PostgreSQL (prod)
• Stripe for secure payments
• Node.js & npm for frontend build