A comprehensive Point of Sale (POS) System implementing core retail transaction workflows with a focus on robust inventory management, payment processing, and audit compliance.
The POS Simulator is a full-featured retail management system built with Python and Streamlit. It provides cashiers and managers with tools to process transactions, manage inventory, handle returns, and maintain comprehensive audit logs.
- π Shopping Cart Management - Add/remove items, apply discounts, calculate taxes
- π³ Payment Processing - Support for cash and card payments with change calculation
- π§Ύ Receipt Generation - PDF receipt generation with detailed transaction info
- π¦ Inventory Management - Real-time stock tracking with low-stock alerts
- π Sales Reporting - Daily sales summaries and transaction analytics
- π Returns & Exchanges - Process product returns and exchanges
- π₯ Role-Based Access Control - Manager, Cashier, and Auditor roles
- π Audit Logging - Comprehensive activity logging for compliance
- π₯ Bulk Import - Import products from CSV/JSON files
- π° Approval Workflows - Manager approval for high-value discounts and voids
- Backend: Python
- Frontend: Streamlit
- Database: MySQL
- PDF Generation: xhtml2pdf, ReportLab
- ORM: SQLAlchemy
- Python 3.8+
- MySQL 8.0+
- Dependencies listed in
requirements.txt
git clone https://github.com/bugsNburgers/POS_self.git
cd POS_selfpip install -r requirements.txtCreate a .env file in the project root:
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=1234
MYSQL_DB=pos_dbEnsure MySQL is running and create the database schema (consult your database setup documentation).
streamlit run app.pyThe application will be available at http://localhost:8501
POS_self/
βββ app. py # Main Streamlit application
βββ requirements. txt # Python dependencies
βββ . env # Environment variables (create locally)
βββ pytest.ini # Pytest configuration
βββ . pylintrc # Pylint configuration
β
βββ services/ # Business logic layer
β βββ __init__.py # Service exports
β βββ db. py # Database connection pooling
β βββ auth_service.py # User authentication & authorization
β βββ cart_service.py # Shopping cart logic
β βββ payment_service.py # Payment processing
β βββ receipt_service.py # Receipt generation
β βββ stock_service.py # Inventory management
β βββ import_service.py # CSV/JSON product import
β βββ return_service.py # Return/exchange processing
β βββ approval_service.py # Approval workflows
β βββ report_service.py # Sales reporting
β βββ logs_service.py # Activity log queries
β βββ monitoring_service.py # System monitoring
β
βββ pages/ # Streamlit pages (UI routes)
β βββ cart.py # Cart management page
β βββ payment.py # Payment processing page
β βββ receipt.py # Receipt display page
β βββ returns.py # Return processing page
β βββ reports.py # Sales reports page
β βββ stock.py # Stock management page
β βββ import_products.py # Product import page
β βββ users.py # User management page
β βββ approvals.py # Approval requests page
β βββ logs.py # Activity logs page
β βββ monitoring. py # System monitoring page
β
βββ assets/ # Static assets
β βββ receipt_template.html # Receipt PDF template
β
βββ tests/ # Unit and integration tests
β βββ test_auth.py # Authentication tests
β βββ test_cart.py # Cart logic tests
β βββ test_payment.py # Payment processing tests
β βββ test_import.py # Import functionality tests
β βββ ...
β
βββ DB/ # Database scripts & schemas
β
βββ CART_README.md # Cart feature documentation
βββ STOCK_IMPORT_README.md # Import feature documentation
βββ CICD pipeline. md # CI/CD setup documentation
- Full system access
- Approve/deny discount and void requests
- User management
- System monitoring
- All reports and inventory features
- Process transactions
- View cart and payment
- Generate receipts
- Process returns (with limitations)
- View own activity logs
- Discounts >10% require manager approval
- Read-only access to activity logs
- Compliance reporting
- No transaction permissions
Connection pooling for MySQL with prepared statements and transaction support.
User login, password verification, role-based access control, and audit logging.
- Add items to cart
- Quantity updates
- Line-item discounts
- GST calculation
- Cart persistence
- Cash payment processing
- Card payment integration
- Change calculation
- Stock decrement on payment
- PDF receipt generation using Jinja2 templates
- Receipt storage in database
- Receipt retrieval and display
- Real-time inventory tracking
- Low stock alerts
- Stock adjustments
- Stock history
- CSV/JSON product import
- Data validation
- Batch insert with duplicate handling
- Import audit logging
- Manager approval requests
- Discount approval tracking
- Void transaction approvals
- Comprehensive audit trails
- Log filtering and search
- Export capabilities
Run tests using pytest:
# Run all tests
pytest
# Run tests with coverage
pytest --cov=services tests/
# Run specific test file
pytest tests/test_cart. py -vRefer to the individual module docstrings and the CART_README.md and STOCK_IMPORT_README.md files for detailed API documentation on specific features.
- Create feature branch from
main - Make changes and write tests
- Run pytest to ensure all tests pass
- Commit with conventional commit messages
- Push and create pull request for review
- Database connection pooling (5 connection pool size)
- Decimal precision for financial calculations
- Indexed queries for receipt and transaction lookups
- Batch operations for bulk imports
- User-friendly error messages in Streamlit UI
- Detailed logging of system errors
- Transaction rollback on failures
- Validation of all user inputs
Developed for retail point-of-sale operations.
For more detailed information on specific features:
- Cart Operations: See
CART_README.md - Product Imports: See
STOCK_IMPORT_README.md - CI/CD Pipeline: See
CICD pipeline.md