This is a comprehensive e-commerce API built with Django REST Framework that supports multi-tenant architecture, allowing both individual sellers and store owners to manage their products and orders.
- Clone the repository
- Create a virtual environment:
python -m venv env
source env/bin/activate # On Windows: env\Scripts\activate- Install dependencies:
pip install -r requirements.txt-
Set up environment variables (see Environment Variables section)
-
Run migrations:
python manage.py migrate- Start the development server:
python manage.py runserverThe API uses JWT (JSON Web Tokens) for authentication. Include the token in the Authorization header:
Authorization: Bearer <your_token>
- User API - User management, authentication, and profiles
- Product API - Product management, categories, and variants
- Cart API - Shopping cart operations
- Order API - Order management and tracking
- Website API - Multi-tenant website management
- Tracking API - Analytics and visit tracking
Create a .env file in the root directory with the following variables:
SECRET_KEY=your_secret_key
DEBUG=True
# AWS S3 Configuration
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_STORAGE_BUCKET_NAME=your_bucket_name
AWS_S3_REGION_NAME=your_region
# Database Configuration
PGDATABASE=your_db_name
PGUSER=your_db_user
PGPASSWORD=your_db_password
PGHOST=your_db_host
PGPORT=your_db_portThe API supports different user types with varying permissions:
ADMIN- Full system accessCUSTOMER- Can browse products, make ordersVENDOR- Can manage products and fulfill ordersINDIVIDUAL-SELLER- Can sell products individuallySTORE-OWNER- Can manage a full store with multiple products
All API endpoints return responses in the following format:
{
"type": "success|error",
"message": "Description of the result",
"data": {} // Optional data object
}