A RESTful e-commerce web application featuring products, reviews, a server-side shopping cart, and checkout functionality.
This project uses a Django + Django REST Framework backend and a vanilla HTML/CSS/JavaScript frontend.
CRUD operations are implemented using a mix of DRF generic class-based views and APIView for transactional logic such as cart management and checkout.
If you are using a custom products.json, place it in:
django/mystore/data/
Ensure the file follows the same structure and filename as the initially provided products.json.
This file is used to seed the database with initial product data.
All endpoints are prefixed with /api/.
- POST
/api/products/
Body Example:
{
"name": "Fireproof Blanket",
"price": 19.99,
"quantity": 0,
"length": "10.00",
"width": "8.00",
"height": "1.00",
"description": "For small kitchen fires."
}- GET
/api/products/
- GET
/api/products/?search=<name>
Example:
/api/products/?search=blanket
- GET
/api/products/?in_stock=true - GET
/api/products/?in_stock=false
- GET
/api/products/<id>/
Example:
/api/products/1/
- PUT
/api/products/<id>/
Body Example:
{
"name": "Fireproof Blanket",
"price": 24.99,
"quantity": 5,
"length": "10.00",
"width": "8.00",
"height": "1.00",
"description": "Updated description."
}- DELETE
/api/products/<id>/
- POST
/api/products/reviews/
Body Example:
{
"user": 1,
"product": 1,
"rating": 9,
"comment": "Works great!"
}- GET
/api/products/reviews/?product_id=<id>
Example:
/api/products/reviews/?product_id=1
- GET
/api/cart/
- POST
/api/cart/items/
Body Example:
{
"product_id": 1,
"quantity": 2
}- PATCH
/api/cart/items/<item_id>/
Body Example:
{
"quantity": 5
}- DELETE
/api/cart/items/<item_id>/delete/
- POST
/api/orders/checkout/
Body Example:
{
"purchaser_name": "Gurtej Grewal",
"items": [
{ "product_id": 1, "quantity": 2 },
{ "product_id": 2, "quantity": 1 }
]
}- GET
/api/orders/
- GET
/api/orders/<id>/
Example:
/api/orders/1/
- Docker & Docker Compose installed
- Python 3.10+ (for local development)
# Clone the repository
git clone https://github.com/GrewalCreator/E-Commerce-Webapp.git
cd E-Commerce-Webapp
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate
# Install backend dependencies
pip install -r django/requirements.txt
# Run migrations
cd django
python manage.py check
python manage.py makemigrations mystore
python manage.py migrate
python manage.py createsuperuserdocker-compose up --buildVisit:
http://localhost:8080
docker-compose down
deactivateAuthor: Gurtej Grewal
