A feature-rich backend built and cover all of Django and Django REST Framework uses. Live Link : http://147.93.110.37:8000/
- Authentication using JWT tokens with Djoser
- Product catalog with categories and collections
- Shopping cart functionality
- Order management system
- Redis caching for improved performance
- Celery for asynchronous tasks
- Email notifications
- User management
- Product reviews and ratings
- Comprehensive test suite
- API documentation
- Django 5.2.2
- Django REST Framework 3.16.0
- MySQL/POSTGRESQL Database
- Redis for caching and Celery broker
- Celery for async tasks
- JWT Authentication
- CORS support
- Python 3.x
- MySQL/POSTGRESQL
- Redis Server
- Clone the repository:
git clone <repository-url>
cd storefront-django
- Install dependencies using Pipenv:
pipenv install
- For Development run
pipenv shell
- Set up the MySQL database:
mysql -u root -p
CREATE DATABASE storefront;
- Populates the database with seed.sql
python manage.py seed_db
- Configure environment variables:
SECRET_KEY=your-secret-key
DEBUG=True
DJANGO_LOG_LEVEL=INFO
DJANGO_SETTINGS_MODULE=storefront.settings.prod(for production)
- Database Migrations:
python manage.py makemigrations
python manage.py migrate
- Create a superuser:
python manage.py createsuperuser
Run the development server:
python manage.py runserver
Start Celery worker:
celery -A storefront worker --loglevel=info
Start Celery beat:
celery -A storefront beat --loglevel=info
core/
- User management and base functionalitystore/
- Main e-commerce functionalityplayground/
- Testing and development endpointslikes/
- Product rating systemtags/
- Product tagging systemstorefront/
- Project settings and configuration
POST /auth/jwt/create/
- Get JWT tokenPOST /auth/jwt/refresh/
- Refresh JWT tokenPOST /auth/users/
- Register new userGET /auth/users/me/
- Get current user details
GET /store/products/
- List all productsPOST /store/products/
- Create a productGET /store/products/{id}/
- Get product detailsPUT /store/products/{id}/
- Update productDELETE /store/products/{id}/
- Delete productGET /store/products/{id}/reviews/
- Get product reviews
GET /store/collections/
- List all collectionsPOST /store/collections/
- Create collectionGET /store/collections/{id}/
- Get collection detailsPUT /store/collections/{id}/
- Update collectionDELETE /store/collections/{id}/
- Delete collection
POST /store/carts/
- Create cartGET /store/carts/{id}/
- Get cart detailsPOST /store/carts/{id}/items/
- Add item to cartDELETE /store/carts/{id}/
- Delete cartPATCH /store/carts/{id}/items/{id}/
- Update cart itemDELETE /store/carts/{id}/items/{id}/
- Remove cart item
GET /store/orders/
- List user ordersPOST /store/orders/
- Create orderGET /store/orders/{id}/
- Get order detailsPATCH /store/orders/{id}/
- Update order
GET /store/customers/
- List customersGET /store/customers/me/
- Get current customerPUT /store/customers/me/
- Update customer profile
GET /store/products/{id}/reviews/
- List product reviewsPOST /store/products/{id}/reviews/
- Create reviewDELETE /store/products/{id}/reviews/{id}/
- Delete review
Run tests using pytest:
pytest
For development with auto-reloading:
ptw
Load testing with Locust:
locust -f locustfiles/browse_products.py
The project uses Redis for caching with the following configuration:
- Cache timeout: 10 minutes
- Cache backend: django-redis
SMTP settings for development:
- Host: localhost
- Port: 2525
- Default sender: [email protected]
- Django Debug Toolbar
- Logging Configuration
- Error Tracking
- Database backups
- Cache invalidation
- Session cleanup
- Media files management
- Celery Flower
- Redis Commander
- MySQL Workbench/ NEON
- Set DEBUG=False in production
- Configure proper ALLOWED_HOSTS
- Use proper SECRET_KEY
- Set up proper database credentials
- Configure proper email settings
- Set up static files with WhiteNoise
This project is licensed under the MIT License - see the LICENSE file for details.