Xeon is a state-of-the-art, high-performance E-Commerce platform built with Django and Django REST Framework (DRF). It features a premium, responsive glassmorphic HTML user interface as well as a robust, fully-documented REST API backend.
- Core Framework: Django 4.2+
- REST APIs: Django REST Framework (DRF)
- Database:
- PostgreSQL (Production / Render)
- SQLite (Local Development)
- Styling & Assets: Vanilla CSS (Premium Dark Mode & Glassmorphic components)
- Static Assets Serving: WhiteNoise (Compressed & Manifest-cached serving)
- Production Server: Gunicorn
Ensure you have Python 3.10+ and Git installed on your local machine.
Clone the repository and install dependencies inside a Python virtual environment:
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
# On Windows:
venv\Scripts\activate
# On Linux/macOS:
source venv/bin/activate
# Install requirements
pip install -r requirements.txtRun the initial migrations to set up the database schema:
python manage.py migrateA script has been provided to seed the database with sample products, categories, admin users, and media links. Run it using:
python seed_data.pyStart the Django development server:
python manage.py runserverVisit http://127.0.0.1:8000/ in your browser.
All API endpoints are under the /api/ prefix.
The production base URL is: https://ecommerce.hrithikuday.me
Visiting the API Root (GET https://ecommerce.hrithikuday.me/api/) returns the list of available resource endpoints:
{
"categories": "https://ecommerce.hrithikuday.me/api/categories/",
"products": "https://ecommerce.hrithikuday.me/api/products/",
"cart": "https://ecommerce.hrithikuday.me/api/cart/",
"orders": "https://ecommerce.hrithikuday.me/api/orders/",
"media-urls": "https://ecommerce.hrithikuday.me/api/media-urls/"
}Generates a REST token for programmatic API authentication.
- Endpoint:
/api/auth/login/ - Method:
POST - Payload:
{ "username": "your_username", "password": "your_password" } - Success Response (200 OK):
{ "token": "4a5c8e3...", "user": { "id": 1, "username": "your_username", "email": "user@example.com", "role": "BUYER", "phone": null, "address": null } }
Manages product categories.
- Endpoint:
/api/categories/ - Authentication:
None(Public Read), admin/seller (Write) - Methods:
GET /api/categories/- List all categories.GET /api/categories/<slug>/- Retrieve a category by slug.POST /api/categories/- Create a new category.PUT /api/categories/<slug>/- Update a category.DELETE /api/categories/<slug>/- Delete a category.
- Category Fields:
id(int, read-only)name(string, required)slug(string, read-only auto-generated)description(string, optional)image_url(string, optional)product_count(int, read-only)
Manages items in the product catalog.
- Endpoint:
/api/products/ - Authentication:
None(Public Read), admin/seller (Write) - Methods:
GET /api/products/- List all active products.- Query Parameters:
category=<slug>(filter by category),search=<text>(search in name or description).
- Query Parameters:
GET /api/products/<slug>/- Retrieve product details.POST /api/products/- Add a new product.PUT /api/products/<slug>/- Edit a product.DELETE /api/products/<slug>/- Delete a product.
- Product Fields:
id(int, read-only)category(int, category ID reference)category_name(string, read-only)name(string, required)slug(string, read-only auto-generated)description(string, optional)price(decimal, required)currency(string, defaults to "USD")stock(int, defaults to 0)image_url(string, optional)is_active(boolean, defaults to True)
Manages the user's shopping cart.
- Endpoint:
/api/cart/ - Authentication: Required (
TokenorSessionAuth) - Methods:
GET /api/cart/- View current cart status (items, quantities, and total price).POST /api/cart/add/- Add an item to the cart.- Payload:
{ "product_id": 1, "quantity": 2 }
- Payload:
POST /api/cart/update/- Update item quantity.- Payload:
{ "item_id": 4, "quantity": 3 }
- Payload:
POST /api/cart/clear/- Clear all items from the cart.
- Response Payload (Cart Schema):
{ "id": 1, "user": 2, "items": [ { "id": 4, "product": { ...product_data... }, "quantity": 3, "total_price": "89.97" } ], "total_price": "89.97", "item_count": 3 }
Allows buyers to place and view orders.
- Endpoint:
/api/orders/ - Authentication: Required (
TokenorSessionAuth) - Methods:
GET /api/orders/- Retrieve order history for the authenticated user.GET /api/orders/<id>/- Retrieve details of a specific order.POST /api/orders/- Create a new order from current cart items.- Payload:
{ "shipping_address": "123 Main St, New York, NY", "billing_address": "123 Main St, New York, NY" }
- Payload:
- Order Fields:
id(int, read-only)total_amount(decimal, read-only generated from cart)status(string, e.g., "PAID", "PENDING")shipping_address(string, required)billing_address(string, optional)items(array, read-only lists of products ordered)payment(object, payment reference & transaction details)
Manages dynamic custom external media and marketing links.
- Endpoint:
/api/media-urls/ - Authentication: Required (
TokenorSessionAuth) - Methods:
GET /api/media-urls/- List links. (Sellers view all links; Buyers view only their created links).POST /api/media-urls/- Create a new link.- Payload:
{ "title": "Xeon Ad Campaign", "url": "https://youtube.com/example", "url_type": "VIDEO" }
- Payload:
PUT /api/media-urls/<id>/- Update a link.DELETE /api/media-urls/<id>/- Delete a link.
The repository is pre-configured with Render Blueprint files:
render.yaml: Multi-service configuration creating a free PostgreSQL DB and a Python Web Service.build.sh: Automatic build script which installs python dependencies, runscollectstatic, and runs database migrations on startup..gitattributes: Configured to force LF line-endings onbuild.shwhen pushing to Git, preventing bash scripting errors on Render's Linux server.
To host:
- Connect your GitHub repository to Render.
- Select New Blueprint and link the repository.
- Render will deploy the infrastructure and output the live link automatically.