A comprehensive e-commerce REST API and GraphQL backend built with Django REST Framework. The platform provides a complete solution for managing supplement products, user authentication, blog content, and order management with professional-grade features.
Supplement Store is a production-ready backend solution for e-commerce platforms specializing in supplement sales. The system is built with scalability, security, and maintainability as core principles.
- Product Management: Complete CRUD operations for supplement products with category organization
- User Authentication: JWT-based authentication with role-based access control (RBAC)
- Blog System: Content management system for blog posts with status control
- GraphQL API: Modern GraphQL endpoint for flexible querying alongside REST API
- Admin Dashboard: Django admin interface for content and user management
- Multi-API Support: Both REST and GraphQL interfaces
- Security: Role-based permissions, custom authentication, CORS support
- Database Design: Optimized relational schema with proper indexing
- Scalability: Modular Django app architecture for horizontal scaling
- Documentation: Complete API documentation with examples and schema visualization
- Backend Framework: Django 4.x+
- API Frameworks: Django REST Framework, Graphene-Django
- Database: SQLite (development) / PostgreSQL (production-ready)
- Authentication: JWT (JSON Web Tokens)
- Language: Python 3.8+
supplement_store/ # Main project configuration
├── settings.py # Django settings and configuration
├── urls.py # URL routing
├── schema.py # GraphQL schema definition
└── graphql_middleware.py # GraphQL custom middleware
blog/ # Blog management app
├── models.py # Blog post models
├── views.py # REST API views
├── views_generic.py # Generic views
├── serializers.py # API serializers
└── admin.py # Admin configuration
products/ # E-commerce products app
├── models.py # Product and category models
├── views.py # REST API views
├── views_generic.py # Generic views
├── serializers.py # API serializers
└── admin.py # Admin configuration
users/ # User management app
├── models.py # User profile model
├── views.py # REST API views
├── views_auth.py # Authentication endpoints
├── authentication.py # JWT authentication logic
├── permissions.py # Custom permission classes
├── serializers.py # API serializers
└── admin.py # Admin configuration
Comprehensive REST API documentation available in API_DOCUMENTATION.md
Main Endpoints:
POST /api/auth/register/- User registrationPOST /api/auth/login/- User loginGET /api/products/- List all productsPOST /api/products/- Create new product (admin only)GET /api/blog/- List blog postsPOST /api/blog/- Create blog post (admin only)
Interactive GraphQL playground available at /graphql/
Complete GraphQL documentation available in GRAPHQL_DOCUMENTATION.md
Example Query:
{
products(first: 10) {
edges {
node {
id
name
price
category {
name
}
}
}
}
}- Python 3.8 or higher
- pip (Python package manager)
# Clone the repository
git clone [repository-url]
cd supplement
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run migrations
python manage.py migrate
# Create superuser for admin access
python manage.py createsuperuser
# Start development server
python manage.py runserverThe API will be available at http://localhost:8000/
Create a .env file in the project root:
SECRET_KEY=your-secret-key
DEBUG=False
ALLOWED_HOSTS=localhost,127.0.0.1
DATABASE_URL=postgresql://user:password@localhost/supplement_dbPostgreSQL is recommended for production:
# Using PostgreSQL (recommended for production)
pip install psycopg2-binaryComprehensive test suite included:
# Run all tests
python manage.py test
# Run tests with coverage report
python manage.py test --verbosity=2Test files are located in each app's tests.py file.
- API_DOCUMENTATION.md - Complete REST API reference with request/response examples
- GRAPHQL_DOCUMENTATION.md - GraphQL schema and query examples
- TESTING.md - Testing guidelines and best practices
- postman_collection.md - Postman collection for API testing
- Web Server: Gunicorn or uWSGI
- Reverse Proxy: Nginx
- Database: PostgreSQL
- Caching: Redis
- Task Queue: Celery (for async operations)
python manage.py collectstatic
python manage.py check --deploy- Clean, maintainable code with proper separation of concerns
- Comprehensive error handling and validation
- RESTful API design principles
- GraphQL best practices implementation
- Modular and extensible architecture
- Payment gateway integration (Stripe, PayPal)
- Email notifications and verification
- Order tracking and management
- Advanced product filtering and search
- Review and rating system
- Wishlist functionality
- Analytics and reporting dashboard
✓ Scalable: Modular Django architecture supports growth
✓ Maintainable: Clean code structure and comprehensive documentation
✓ Flexible: Both REST and GraphQL APIs for diverse client needs
✓ Secure: Industry-standard authentication and permission system
✓ Production-Ready: Optimized for deployment and monitoring
This is an educational project developed as part of academic coursework. It demonstrates professional software engineering practices, including API design, authentication, database modeling, and REST/GraphQL implementation patterns.
- Full-stack web application development
- RESTful and GraphQL API design
- Database design and optimization
- User authentication and authorization
- Software testing and quality assurance
- API documentation standards
For questions or issues, please refer to the project documentation or contact the development team.
[Specify your license here]