The ecommerce platform is built as a Django application using Django Ninja for API development. It provides APIs for managing products, orders, carts, and user interactions with a focus on developer experience and production deployment.
- Modern Tooling: UV package management, Docker containerization
- Organized Structure: Modular models and utilities
- Developer Experience: Hot reloading, automated scripts, code quality tools
- API Documentation: Swagger/OpenAPI integration
- Containerized Development: Docker-based development with hot reloading
- Monolithic Django 5.2+ application
- Django Ninja Extra for API development
- PostgreSQL for primary database
- Redis for caching and session management
- Celery for background tasks
- S3 for file storage
- Stripe for payment processing
- Django 5.2+ with Django Ninja for API development
- PostgreSQL for database
- Redis for caching and Celery broker
- Celery for background tasks
- Docker for containerization
- UV for fast Python package management
ecommerce-api/
├── api/ # Core configuration & shared utilities
│ ├── config/ # Centralized configuration
│ │ ├── constants.py # Application constants
│ │ ├── error_messages.py # Standardized messages
│ │ └── settings.py # Runtime settings
│ └── utils/ # Utility modules
│ ├── validation.py # Data validation
│ ├── formatting.py # Data formatting
│ └── pagination.py # API pagination
├── core/ # User management & core models
│ ├── models/ # Core model files
│ ├── controllers/ # API controllers
│ ├── schemas/ # Pydantic schemas
│ └── management/ # Management commands
├── products/ # Product catalog
│ ├── models/ # Product models
│ ├── controllers/ # Product API endpoints
│ └── schemas/ # Product schemas
├── cart/ # Shopping cart
├── orders/ # Order management
├── payments/ # Payment processing
└── scripts/ # Development scripts
├── dev_setup.sh # Development setup
├── code_quality.sh # Code quality checks
└── db_setup.sh # Database setup
- RESTful API endpoints with OpenAPI documentation
- JWT authentication
- Request validation using Pydantic
- Auto-generated interactive documentation (Swagger/ReDoc)
- CORS support for frontend integration
- PostgreSQL for primary data storage
- Redis for:
- Session management
- Cache layer
- Celery message broker
- Basic database optimization with proper indexing
- Redis-based caching for:
- Database queries
- API responses
- Session storage
- Basic cache invalidation on model updates
- Celery for async tasks:
- Order processing
- Email notifications
- Report generation
- Basic error handling and retries
- Flower for task monitoring
- Local file storage for development
- S3 integration ready for production
- Basic image handling for product images
- JWT authentication with Django Ninja JWT
- Input validation using Pydantic
- Django's built-in security features
- CORS configuration
- Environment-based configuration
The application uses Docker for both development and production environments:
- Hot Reloading: Enabled through volume mounting and custom Django management command
- Services:
- Django web server with hot reloading
- PostgreSQL 17 database
- Redis for caching and Celery
- Celery worker and beat scheduler
- Flower for Celery monitoring
- Development Server: Uses custom
runserver_dev.pycommand for enhanced development features
services:
django: # Main Django application with hot reloading
db: # PostgreSQL 17 database
redis: # Redis for caching and Celery broker
celery: # Background task worker
celery-beat: # Task scheduler
flower: # Celery monitoring interfaceThe Django service is configured for development with:
-
Volume Mounting: Code changes are immediately reflected
-
Custom Management Command:
python manage.py runserver_devprovides:- Enhanced hot reloading
- SQL query printing (with
--print-sqlflag) - Automatic admin panel refresh
- Threading support for better performance
-
Development Entrypoint:
docker-entrypoint-dev.shhandles:- UV package management
- Database and Redis connectivity checks
- Virtual environment setup
# Start all services with hot reloading
docker-compose up --build
# The Django service runs with hot reloading:
python manage.py runserver_dev 0.0.0.0:8000
# Access points:
# - API Documentation: http://localhost:8000/api/docs
# - Admin Panel: http://localhost:8000/admin
# - Celery Monitoring: http://localhost:5555The project uses UV for fast Python package management:
# Install dependencies
uv pip install -e .
# Development setup
uv venv .venv
uv pip install --python .venv/bin/python [packages]Development scripts in the scripts/ directory:
dev_setup.sh: Development environment setupcode_quality.sh: Linting and quality checksdb_setup.sh: Database setup and migrationstest_feature.sh: Feature testingcheck_health.sh: API health checks
For production, use the production Docker Compose configuration:
docker-compose -f docker-compose.prod.yml up --build -dThe API provides interactive documentation:
- Swagger UI: Available at
/api/docs - ReDoc: Available at
/api/redoc - OpenAPI Schema: Auto-generated from Django Ninja
The project includes:
- Unit Tests: Using pytest
- Feature Testing: Custom scripts for endpoint testing
- Health Checks: Automated monitoring scripts
- Complete Ecommerce API: Product, Order, Cart, Customer management with comprehensive features
- Authentication: JWT-based authentication with Django Ninja JWT
- Database: PostgreSQL 17 with optimized schema and relationships
- Advanced Caching: Redis 7.2 with versioning, warming, and management commands
- Background Tasks: Celery with comprehensive task management
- Modern Admin: Django Unfold admin panel with enhanced features
- Interactive Documentation: Auto-generated Swagger/ReDoc API docs
- Professional Development Tools: Hot reloading, comprehensive scripts, quality checks
- Production Ready: Docker configurations, deployment scripts, monitoring
- Code Quality: Consistent formatting and linting
- Developer Experience: Fast setup and hot reloading
- API Documentation: Interactive Swagger/ReDoc interfaces
- Testing: Unit tests and feature testing scripts
- Containerization: Docker-based development and deployment
This is a public learning project designed to demonstrate modern Django development and ML integration. The roadmap includes:
- ✅ Enhanced caching strategies (Redis with versioning)
- ✅ Performance optimization (query optimization, caching)
- ✅ Additional security features (RBAC, comprehensive validation)
- ✅ Extended API functionality (comprehensive ecommerce features)
- Analytics and reporting features
- Advanced discount system (coupons, gift cards)
- Frontend integration examples
- CI/CD pipeline setup
- Product recommendation systems
- Demand forecasting models
- Fraud detection algorithms
- Computer vision for product categorization
- NLP for review analysis
See docs/machine-learning-features.md for detailed ML roadmap and learning objectives.
- Real-time analytics
- A/B testing framework
- Model monitoring and deployment
- MLOps best practices