How hackstarsj/amazoncloneecommerceprojectusingdjangoreact works
Project Type and Purpose
• This is a full‑stack e‑commerce web application (an “Amazon clone”) built on a Django backend (Python) and a React frontend (JavaScript).
• The backend is logically decomposed into Django apps (InventoryServices, OrderService, ProductServices, UserServices) that implement core domain services.
• The frontend is a React SPA that communicates via REST APIs, uses Redux for state management, and implements dynamic multi‑step forms, theming, and user workflows (authentication, product management, purchase/sales orders, warehouse management).
File‑Structure Analysis
• Backend/EcommerceInventory: a Django project root containing global settings, middleware (PermissionMiddleware), helper utilities, URL routing, ASGI/WSGI entrypoints, templates, and a local sqlite3 (or MySQL in production).
• Backend/EcommerceInventory/…/apps: four Django apps—InventoryServices, OrderService, ProductServices, UserServices—each with its own controllers, models, migrations, views, and URLs.
• Frontend/ecommerce_inventory: a Create‑React‑App boilerplate with public/ (static HTML), src/ (components, hooks/APIHandler.js, layout, pages, redux store & reducers, utils), and environment configs.
• Dev‑ops files: Dockerfile, CI/CD workflow (/.github/workflows/deploy.yml), AWS deployment steps (S3_SETUP.txt, CI_CD_Deployment_Step_Using_Docker_AWS.txt), ER_Diagram.pdf.
Key Components
a. Frontend Layer (React SPA)
• Browser/Client
• React components & pages
• Redux store
• APIHandler (HTTP client)
b. API Layer (Django REST)
• ASGI/WSGI server (e.g., Gunicorn or Uvicorn)
• URL dispatcher → routes to app‑specific controllers (AuthController, WarehouseController, etc.)
• Middleware (PermissionMiddleware)
c. Domain Services (Django Apps)
• UserServices: authentication, authorization, user & permission management
• ProductServices: categories, products, reviews, questions
• InventoryServices: warehouse, rack, shelf, stock management
• OrderService: purchase orders, sales orders
d. Database Layer
• MySQL (or sqlite for dev) with tables per app (see ER_Diagram.pdf)
e. External/Infrastructure Services
• Object storage (AWS S3 for static/media)
• CI/CD pipeline (GitHub Actions → Docker build → push to AWS ECR/ECS)
• Hosting (AWS EC2/ECS, Nginx load balancer, RDS)
Relationships & Data Flows
• The React app issues HTTP(S) requests → Django ASGI/WSGI endpoint.
• Django middleware enforces permissions → request routed to appropriate app controller → business logic → ORM → MySQL → response.
• Static/media assets uploaded via frontend → stored in S3 → served via CDN.
• CI/CD pushes Docker images to AWS → deploys backend & frontend containers behind load balancer.
Architectural Patterns & Principles
• Layered architecture: Presentation (React) → API layer (Django) → Domain logic (Django apps) → Persistence (ORM/MySQL).
• Modularity via Django apps for service decomposition.
• RESTful API contract between front and back.
• Single‑page‑application on client; cookie/JWT‑based auth.
• Infrastructure as Code via Docker & GitHub Actions.
Essential Elements
• From Browser → API Gateway (Django)
• Within Django: URL router → Controllers → Models → DB
• From React file uploads → S3
• CI/CD flow: GitHub Actions → Docker → AWS
• Optional: annotate ports (3000 frontend, 8000 backend), protocols (HTTPS), and data formats (JSON).
Step‑by‑Step for the Engineer
1. Start by drawing the React client on top, showing key modules: pages, components, Redux, API handler.