This is a Django REST Framework (DRF) powered backend for an e-commerce platform. It provides APIs for managing users, products, sellers, orders, authentication, and more.
You can test the API using this Postman Collection.
- User Authentication (Registration, Login, Logout, Email Verification, Password Reset)
- Product Management (Categories, Products, Reviews)
- Seller Management (
⚠️ Admin must verify sellers before they can be active) - Order Processing (Cart, Checkout, Payments)
- CSV-Based Delivery Import (Delivery data is migrated using CSV)
- Rate Limiting (Implemented to prevent API abuse)
- RESTful API Design with Django REST Framework
- JWT Authentication for secure access
- PostgreSQL Database for data storage
- Media & Static File Handling
$ git clone https://github.com/your-username/ecommerce-backend.git
$ cd ecommerce-backend
$ python -m venv env
$ source env/bin/activate # On Windows use `env\Scripts\activate`
$ pip install -r requirements.txt
Create a .env
file and add the following details:
SECRET_KEY=your-secret-key
DEBUG=True
DATABASE_URL=postgres://user:password@localhost:5432/dbname
ALLOWED_HOSTS=*
$ python manage.py migrate
$ python manage.py createsuperuser
$ python manage.py runserver
Endpoint | Method | Description |
---|---|---|
/auth/register/ |
POST | Register new user |
/auth/login/ |
POST | Login user |
/auth/logout/ |
POST | Logout user |
/auth/email-verify/ |
GET | Verify email |
/auth/request-password-email/ |
POST | Request password reset |
/auth/set-new-password/ |
POST | Set new password |
Endpoint | Method | Description |
---|---|---|
/api/products/ |
GET, POST | Get all products / Create a product |
/api/products/<id>/ |
GET, PUT, DELETE | Get, update, or delete product |
/api/categories/ |
GET | List all categories |
Endpoint | Method | Description |
---|---|---|
/api/sellers/ |
GET, POST | Get all sellers / Register a seller |
/api/seller-orders/ |
GET | Get seller orders |
/api/sellers/verify/<id>/ |
PUT | Admin-only: Verify a seller |
Endpoint | Method | Description |
---|---|---|
/products/<product_id>/reviews/ |
GET, POST | Get or create product reviews |
/products/<product_id>/reviews/<id>/ |
GET, PUT, DELETE | Get, update, or delete a review |
The delivery database is populated using CSV files. To import delivery data:
$ python manage.py import_csv location_data.csv
To prevent abuse, rate limiting has been implemented for API requests. This restricts the number of requests a user can make within a given time frame.
- Push Code to GitHub
- Create a New Web Service on Render
- Set Up Environment Variables
- Use Gunicorn to Run Django
$ pip install gunicorn
$ gunicorn ecommerce.wsgi:application --bind 0.0.0.0:8000
- Check Logs on Render Dashboard
This project is open-source and available under the MIT License.