As a simple project, I created the Veneva Supermarket Inventory Module System where registered staff members check out orders by entering the amount and submitting. The amount is then deducted from the existing database with the current stocks of the supermarket automatically updating to the recent amount.
- Overview
- Architecture
- Tech Stack
- Getting Started
- Backend Setup
- Frontend Setup
- Key Features
- How It Works
- Project Structure
- Usage
- Development
- Contributing
- Upcoming Updates
- Authors
- Acknowledgments
- Support
This is a complete inventory management solution designed specifically for supermarket operations. It streamlines the checkout process by allowing authorized staff to efficiently manage stock deductions and maintain accurate, real-time inventory records.
The project is organized into two main components:
- Provides RESTful API endpoints for inventory operations using Django REST Framework
- Handles business logic and stock management with Django ORM
- Manages database operations and server-side processing
- Processes order submissions and stock updates
- Implements staff authentication and authorization
- Admin panel for system management
- Modern, responsive user interface
- Consumes backend API services
- Provides intuitive inventory checkout interface
- Real-time stock display and updates
- Staff login and dashboard
- Backend: Django (Render)
- Frontend: React (Vercel)
- Database: PostgreSQL(Supabase)
- Package Manager: pip (Python), npm/yarn (Frontend)
- Frontend: Deployed on Vercel for a seamless integration and automated deployments.
- Backend: Hosted on Render for managing APIs with efficient deployment and scaling.
- Database: Using Supabase for a real-time database solution that supports SQL.
- Deployment URL: https://inventory-system-wine-three.vercel.app/
- Default Staff Credentials:
- Staff ID: 1010
- Password: 12345
Before you begin, ensure you have the following installed:
- Python 3.8 or higher
- pip (Python package manager)
- Node.js (v14 or higher) for frontend
- npm (v6 or higher) or yarn
- Git
- A code editor (VS Code recommended)
git clone https://github.com/Aaronica123/inventory_system.git
cd inventory_systemcd backend# On Windows
python -m venv venv
venv\Scripts\activate
# On macOS/Linux
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the backend/inventory directory with the following variables:
# Django Configuration
DEBUG=True
SECRET_KEY=your-secret-key-here-change-in-production
ALLOWED_HOSTS=localhost,127.0.0.1
# Database Configuration
DB_ENGINE=django.db.backends.sqlite3
DB_NAME=db.sqlite3
# For PostgreSQL (optional):
# DB_ENGINE=django.db.backends.postgresql
# DB_NAME=veneva_supermarket
# DB_USER=your_db_user
# DB_PASSWORD=your_db_password
# DB_HOST=localhost
# DB_PORT=5432
# JWT Configuration
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRATION_HOURS=24
# API Configuration
CORS_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:8000
API_BASE_URL=http://localhost:8000
# Navigate to the project directory where manage.py is located
cd inventory
# Create migrations
python manage.py makemigrations
# Apply migrations
python manage.py migrate
# Load initial data (if available)
python manage.py loaddata initial_data# Collect static files for production
python manage.py collectstatic --noinputNavigate back to the backend folder and run:
# From backend directory
cd inventory
python manage.py runserverThe backend server will be available at http://localhost:8000
curl http://localhost:8000/api/health/
# or access in browser: http://localhost:8000/admin/Navigate to http://localhost:8000/admin/ and log in with your superuser credentials to manage the system.
cd frontendnpm installCreate a .env file in the frontend directory with the following variables:
# API Configuration
REACT_APP_API_BASE_URL=http://localhost:8000
REACT_APP_API_TIMEOUT=30000
# Application Configuration
REACT_APP_APP_NAME=Veneva Supermarket
REACT_APP_VERSION=1.0.0
# Feature Flags
REACT_APP_ENABLE_ANALYTICS=falseDevelopment Mode:
npm startThe frontend application will be available at http://localhost:3000
Build for Production:
npm run buildOpen your browser and navigate to http://localhost:3000
- Secure login for registered staff members using Django authentication
- Role-based access control (Admin, Manager, Staff)
- Session management and auto-logout
- JWT token-based API authentication
- Intuitive interface for entering order quantities
- Quick product search and selection
- Multiple payment methods support
- Order validation and confirmation
- Real-time inventory updates upon order submission
- Prevents overselling with stock validation
- Transaction logging for audit trails
- Atomic database transactions for consistency
- Real-time inventory level display
- Low stock alerts and notifications
- Stock history and analytics
- Inventory movement tracking
- Order creation and submission
- Order history and receipt generation
- Cancel and modify orders (with proper authorization)
- Order status tracking
- Instant updates across all sessions
- Automatic conflict resolution
- Data consistency and integrity
- Django ORM for reliable data handling
- Add and manage staff accounts
- Permission levels and access control
- Activity logging and audit trails
- Staff member enters credentials
- Django authentication validates against the database
- Staff receives JWT token for API requests
- Dashboard loads with available inventory
- View all available products
- Filter by category, price, or stock level
- Search for specific items
- API fetches data from Django backend
- Click on product to view details
- Check current stock availability
- Add to order cart
- Specify quantity to check out
- Verify unit price and total amount
- Review order summary
- Confirm the order details
- Process payment (if applicable)
- System validates stock availability via API
- Backend deducts ordered quantity from inventory using Django ORM
- Database transaction ensures consistency
- Confirmation message sent to staff
- Stock levels updated automatically
- Receipt generated and displayed
- Order details saved for audit
- Dashboard updated with new inventory levels
- Analytics and reports updated
Frontend (Order Submission)
β
API Request to Django Backend
β
Django Views/Viewsets Processing (m1 app)
β
Django ORM Database Query
β
Stock Deduction Logic
β
Database Transaction Commit
β
Return API Response
β
Frontend Updates Display
inventory_system/
β
βββ backend/ # Django Backend
β βββ inventory/ # Main Django Project (Settings, URLs, Config)
β β βββ settings.py # Django settings and configuration
β β βββ urls.py # Main URL routing
β β βββ wsgi.py # WSGI configuration
β β βββ asgi.py # ASGI configuration
β β βββ manage.py # Django management script
β β βββ __init__.py
β β
β βββ m1/ # Main App (Models, Views, Serializers)
β β βββ migrations/ # Database migrations
β β β βββ __init__.py
β β β βββ 0001_initial.py
β β β βββ ...
β β β
β β βββ models.py # Database models
β β β βββ User/Staff models
β β β βββ Product models
β β β βββ Order models
β β β βββ Inventory models
β β β βββ Category models
β β β
β β βββ views.py # Django views and viewsets
β β β βββ AuthenticationViews
β β β βββ ProductViewSets
β β β βββ OrderViewSets
β β β βββ InventoryViewSets
β β β
β β βββ serializers.py # DRF serializers
β β β βββ UserSerializer
β β β βββ ProductSerializer
β β β βββ OrderSerializer
β β β βββ InventorySerializer
β β β
β β βββ urls.py # App URL routing
β β βββ admin.py # Django admin configuration
β β βββ apps.py # App configuration
β β βββ tests.py # Unit tests
β β βββ __init__.py
β β
β βββ static/ # Static files (CSS, JS, images)
β βββ media/ # Uploaded files/media
β βββ db.sqlite3 # SQLite database (development)
β βββ requirements.txt # Python dependencies
β βββ .env.example # Environment variables example
β βββ .gitignore
β
βββ frontend/ # React/Vue Frontend Application
β βββ src/
β β βββ components/ # Reusable components
β β β βββ Header.jsx
β β β βββ Sidebar.jsx
β β β βββ ProductCard.jsx
β β β βββ OrderForm.jsx
β β βββ pages/ # Page components
β β β βββ Login.jsx
β β β βββ Dashboard.jsx
β β β βββ Inventory.jsx
β β β βββ Orders.jsx
β β β βββ Reports.jsx
β β βββ services/ # API services
β β β βββ authService.js
β β β βββ productService.js
β β β βββ orderService.js
β β β βββ api.js
β β βββ store/ # State management (Redux/Vuex)
β β β βββ actions/
β β β βββ reducers/
β β β βββ store.js
β β βββ styles/ # CSS/SCSS files
β β β βββ global.css
β β β βββ components.css
β β βββ utils/ # Utility functions
β β βββ App.jsx # Root component
β β βββ index.js # Entry point
β βββ public/ # Static assets
β βββ package.json
β βββ .env.example
β βββ .gitignore
β
βββ .gitignore # Git ignore rules
βββ README.md # This file
βββ LICENSE # License information
- Open the application in your web browser
- Enter your registered email/username
- Enter your password
- Click "Login"
- Receive JWT token for API requests
- Navigate to the "Checkout" section
- Search for products or browse by category
- Select an item from the list
- Enter the quantity you want to check out
- Review the order details
- Click "Submit Order"
- Navigate to "Orders" section
- View all your orders
Terminal 1 - Backend (Django):
cd backend/inventory
source venv/bin/activate # or venv\Scripts\activate on Windows
python manage.py runserverTerminal 2 - Frontend:
cd frontend
cd inventory
npm run start/devBackend Tests:
cd backend/inventory
python manage.py test
python manage.py test --verbosity=2
python manage.py test m1 # Test m1 app specificallyFrontend Tests:
cd frontend
npm test
npm run test:coverageBackend Code Style:
cd backend/inventory
# Check code style
pip install flake8
flake8 m1/
# Format code
pip install black
black m1/
# Run linter
pip install pylint
pylint m1/Frontend Code Style:
cd frontend
npm run lint
npm run formatcd backend/inventory
# After modifying models in m1/models.py
python manage.py makemigrations
# Check migration SQL
python manage.py sqlmigrate m1 migration_number
# Apply migrations
python manage.py migrate
# Roll back migrations
python manage.py migrate m1 zeroModels Location: backend/inventory/m1/models.py
Views Location: backend/inventory/m1/views.py
Serializers Location: backend/inventory/m1/serializers.py
URL Routing Location: backend/inventory/m1/urls.py
Example model in m1/models.py:
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=100)
price = models.DecimalField(max_digits=10, decimal_places=2)
stock = models.IntegerField(default=0)
def __str__(self):
return self.nameBackend:
cd backend/inventory
python manage.py collectstatic --noinput
gunicorn inventory.wsgi:application --bind 0.0.0.0:8000Frontend:
cd frontend
npm run buildBackend Debugging:
Add to your Django view in m1/views.py:
import pdb; pdb.set_trace()Or use Django debug toolbar:
pip install django-debug-toolbarFrontend Debugging: Use React DevTools browser extension for React components
To generate requirements.txt after adding new packages:
cd backend
pip freeze > requirements.txtWe welcome contributions from the community! Please follow these guidelines:
-
Fork the repository
git clone https://github.com/Aaronica123/inventory_system.git
-
Create a feature branch
git checkout -b feature/AmazingFeature
-
Make your changes
- Write clean, readable code
- Follow the existing code style
- Add comments where necessary
- Add tests for new functionality
-
Commit your changes
git commit -m 'Add some AmazingFeature' -
Push to the branch
git push origin feature/AmazingFeature
-
Open a Pull Request
- Describe your changes clearly
- Reference any related issues
- Wait for review and feedback
Backend (Python/Django):
- Follow PEP 8 style guide
- Use 4 spaces for indentation
- Write descriptive variable and function names
- Use docstrings for functions and classes
- Keep lines under 79 characters
Frontend (JavaScript):
- Use consistent indentation (2 spaces)
- Follow naming conventions (camelCase for variables, PascalCase for components)
- Write descriptive commit messages
- Add comments for complex logic
We are actively working on exciting new features and improvements to make Veneva Supermarket Inventory System even more powerful and feature-rich.
- Status: Coming Soon
- Description: Comprehensive serializer improvements to strengthen data validation and ensure data integrity across all API endpoints
- Features:
- Advanced field validation for all models
- Custom validation rules for products, orders, and inventory
- Error handling and detailed error messages
- Nested serializers for complex data structures
- Read-only and write-only field management
- Data transformation and normalization
- Status: Under Development
- Description: Seamless integration with M-Pesa payment gateway for secure and convenient mobile money transactions
- Features:
- M-Pesa authentication and authorization
- Payment processing and verification
- Transaction status tracking
- Payment receipt generation
- Refund and payment reversal support
- Real-time payment notifications
- Transaction history and reconciliation
- Status: Planned
- Description: Manage inventory and operations across multiple supermarket branches
- Features:
- Branch management and configuration
- Centralized inventory tracking
- Inter-branch stock transfers
- Consolidated reporting and analytics
- Branch-specific user roles and permissions
- Status: Planned
- Description: Comprehensive analytics and reporting tools for better business insights
- Features:
- Sales analytics and trends
- Inventory performance metrics
- Staff productivity reports
- Customer purchase patterns
- Revenue forecasting
- Status: Planned
- Description: Manage suppliers and streamline procurement processes
- Features:
- Supplier database and contact management
- Purchase orders automation
- Supplier pricing and discounts
- Order history and tracking
- Supplier performance ratings
- Status: Planned
- Description: Native mobile applications for on-the-go inventory management
- Features:
- Staff app for quick checkouts
- Manager app for inventory oversight
- Real-time notifications
- Offline mode support
- Barcode scanning
- Status: Planned
- Description: Advanced security and compliance features
- Features:
- Two-factor authentication (2FA)
- Biometric authentication support
- Encryption for sensitive data
- Audit logs and activity tracking
- GDPR compliance
- Regular security updates
- Performance optimization and caching
- API rate limiting and throttling
- WebSocket implementation for real-time updates
- Automated testing coverage expansion
- Docker containerization
- Kubernetes deployment support
- CI/CD pipeline automation
- Q2 2026: serializer.py enhancements + M-Pesa integration
- Q3 2026: Multi-location support + Advanced analytics
- Q4 2026: Supplier management + Loyalty program
- 2027: Mobile apps + Additional enterprise features
We encourage community contributions! If you're interested in helping develop any of these upcoming features, please:
- Open an issue to discuss your proposed changes
- Create a feature branch
- Submit a pull request with your implementation
- Wait for review and feedback
-
Aaronica123 - Initial project development and implementation
- GitHub: @Aaronica123
- Project Lead and Backend Development
-
Aaron Mutua : Linked In [https://www.linkedin.com/in/aaron-mutua-62687a268]
- Open for community contributions!
- Thanks to all contributors and testers who have helped improve this project
- Community feedback and suggestions for feature improvements
- Inspiration from modern inventory management systems
- Open-source libraries and frameworks used in this project:
- Django and Django REST Framework community
- React/Vue community
- Python community
- Staff members at Veneva Supermarket for providing requirements and feedback
- Development team members who provided guidance and support
- All users and early adopters for their patience and valuable feedback
- Django documentation and community resources
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please:
- Open an issue on the GitHub repository
- Contact the development team
- Check existing documentation and FAQs
- Visit Django and React documentation
Backend Connection Failed
- Ensure the Django development server is running on port 8000
- Check firewall settings
- Verify environment variables in .env file
- Make sure virtual environment is activated
- Verify you're in the correct directory:
backend/inventory
Database Connection Error
- Ensure migrations have been applied:
python manage.py migrate - Check database permissions and configuration in .env
- Try deleting db.sqlite3 and running migrations again (for SQLite)
- Navigate to
backend/inventorydirectory before running migrations
Module Not Found Error
- Ensure all dependencies are installed:
pip install -r requirements.txt - Make sure virtual environment is activated
- Try reinstalling:
pip install --upgrade -r requirements.txt
Login Issues
- Clear browser cache and cookies
- Verify credentials are correct
- Check if account is active in Django Admin
- Verify JWT token is being sent with requests
Stock Update Not Reflecting
- Refresh the page
- Check internet connection
- Verify backend is processing requests
- Check Django logs for errors in m1 app
CORS Errors
- Ensure frontend URL is in CORS_ALLOWED_ORIGINS in .env
- Restart Django server after changing .env
- Check browser console for specific CORS error
API Endpoints Not Found (404)
- Verify URLs are correctly configured in
m1/urls.pyandinventory/urls.py - Check URL patterns and naming conventions
- Restart the Django development server
m1 App Not Recognized
- Ensure
m1is added to INSTALLED_APPS ininventory/settings.py - Verify the m1 directory exists in the backend folder
- Restart Django server
For more help, contact support or open an issue on GitHub.
Last Updated: March 1, 2026
Version: 1.0.0
Status: Active Development