🛍️ eCommerce Backend
A robust, production-ready backend designed to power modern eCommerce experiences. Built with a focus on scalability, security, and developer efficiency using Python and Django.
This project provides a complete server-side solution for an online storefront, handling everything from user authentication and product management to payment processing and shipping logistics. The modular architecture ensures that the system is not only feature-rich but also easy to maintain and extend, making it an ideal foundation for any eCommerce venture.
🚀 Core Features & Capabilities
🔐 Secure & Stateless Authentication
- JWT-Based Sessions: Employs JSON Web Tokens for secure, stateless user authentication, enabling scalable and reliable access control.
- OTP Login: Offers a seamless and secure password-less login option using OTP verification via Twilio, enhancing user experience.
🛒 Comprehensive eCommerce Engine
- Dynamic Product Management: Full support for product variants, rich image galleries, real-time inventory tracking, and flexible pricing.
- Seamless Payments: Securely process transactions with Razorpay integration, supporting a wide range of payment methods.
- Complete Order Lifecycle: From cart to checkout to delivery, manage the entire order pipeline with status updates and tracking.
- User Engagement Tools: Built-in wishlist functionality and a review/rating system to foster customer interaction.
🏠 Dynamic & Headless-Ready Homepage
- Admin-Driven UI: Every component on the home screen—from banners to featured product carousels—is fully customizable through the admin panel without requiring a code change.
- Flexible Content Blocks: Dynamically manage and reorder layout blocks, supporting complex CTAs, offers, and real-time content updates for marketing campaigns.
📄 Automated Invoicing & Logistics
- PDF Invoice Generation: Automatically generates and uploads professional, branded PDF invoices to Amazon S3 upon successful order completion.
- Streamlined Shipping: Deep integration with Shiprocket automates the entire shipping process, from label generation to real-time tracking.
🧱 Technology Stack & Architecture
This project is built on a foundation of powerful and reliable technologies chosen for their ability to deliver performance and scale. Django REST Framework provides the core for building robust APIs, while PostgreSQL ensures data integrity. The entire application is containerized with Docker for consistent, reproducible deployments.
| Component | Tech |
|---|---|
| Backend | Python, Django (DRF) |
| Authentication | JWT, Twilio |
| Payments | Razorpay API |
| Logistics | Shiprocket API |
| Invoicing | HTML Templates (PDF-ready) |
| Database | PostgreSQL |
| Deployment | Docker |
| ORM | Django ORM |
📄 Database Schema
The database schema was designed to be scalable and normalized, clearly defining the relationships between users, products, orders, and other core eCommerce entities. The diagram below illustrates the key models and their connections.
🐳 Development & Deployment Workflow
This project is fully containerized using Docker and Docker Compose, ensuring a consistent and reproducible development environment.
Configuration
Secure and environment-specific settings (like database URLs and API keys) are managed through environment variables in a .env file. This prevents sensitive credentials from being hard-coded into the source code. An example configuration looks like this:
# .env file
DEBUG=True
SECRET_KEY=your-secret-key
DATABASE_URL=postgres://user:pass@db:5432/dbname
TWILIO_ACCOUNT_SID=your-twilio-sid
TWILIO_AUTH_TOKEN=your-twilio-auth-token
RAZORPAY_KEY_ID=your-key
...
Running the Application
The entire application stack—including the Django web server and the PostgreSQL database—is launched with a single command:
docker-compose up --build
Database migrations are then applied using Django's standard management command, executed within the running container:
docker-compose exec web python manage.py migrate
🔌 RESTful API Endpoints
The API follows RESTful principles for predictable and resource-oriented URLs. A complete Postman collection and Swagger/OpenAPI documentation are in development to provide interactive API exploration.
| Resource | Endpoint |
|---|---|
| Products | /api/products/ |
| Categories | /api/categories/ |
| Subcategories | /api/subcategories/ |
| Brands | /api/brands/ |
| Cart | /api/cart/ |
| Orders | /api/orders |
| Invoices | /api/invoices/<order_id>/ |
| Home Sections | /api/home/ |
| Reviews | /api/review/ |
| Payment | /api/payment/ |
| Admin Dashboard | /api/admin/ |
📈 Project Roadmap
- Implement webhooks for real-time status updates from Razorpay & Shiprocket.
- Develop a comprehensive discount and coupon module.
- Integrate a notification service (email/SMS) for order alerts.
- Expand the architecture to support a multi-vendor marketplace model.