A modern, comprehensive Point of Sale (POS) system built with Angular 17+ and Node.js/Express with MongoDB database integration. Designed for retail stores with advanced features including barcode scanning, digital scale integration, user management, and customizable receipt printing.
- π Sales Processing: Quick and efficient checkout process
- π Real-time Cart Management: Dynamic cart with quantity and discount controls
- π° Multiple Payment Methods: Cash, card, transfer, and mixed payments
- π§Ύ Receipt Generation: Customizable print templates
- π¦ Product Catalog: Complete CRUD operations for products
- π·οΈ Category Organization: Multi-level category management with color coding
- π Inventory Tracking: Stock levels, low stock warnings, and alerts
- βοΈ Weight-based Products: Support for products sold by weight
- π· Barcode Scanning:
- Manual barcode input
- Camera-based scanning using device camera (mobile-friendly)
- Integration with barcode scanners
- βοΈ Digital Scale Integration: Web Serial API support for electronic scales
- β Sale Cancellation: Authorized refunds with reason tracking
- πΈ Discount Management: Item-level and transaction-level discounts
- π§Ύ Print Templates: Customizable receipt layouts and formats
- π₯ User Management: Role-based access control (Admin, Manager, Cashier, Employee)
- π’ Provider Management: Supplier information and relationships
- π Sales Reports: Transaction history and analytics
- π JWT Authentication: Secure token-based authentication
- π€ Role-based Permissions: Granular permission system
- π Protected Routes: Route guards for authorized access
- Standalone Components: Modern Angular architecture
- Reactive Forms: Real-time validation and updates
- RxJS Observables: Efficient data streaming
- Service-based Architecture: Separation of concerns
- Route Guards: Authentication and authorization
- RESTful API: Clean API design
- MongoDB/Mongoose: Document-based database
- JWT Authentication: Secure token management
- Middleware: Authentication, error handling, validation
Before you begin, ensure you have the following installed:
- Node.js (v18.x or higher)
- npm (v9.x or higher)
- MongoDB (v6.x or higher) - Running locally or remotely
- Angular CLI (v17.x or higher):
npm install -g @angular/cli
cd c:\Users\IRWIN\Documents\pdevnpm install --save @angular/animations @angular/common @angular/compiler @angular/core @angular/forms @angular/platform-browser @angular/platform-browser-dynamic @angular/router rxjs tslib zone.js
npm install --save-dev @angular-devkit/build-angular @angular/cli @angular/compiler-cli typescriptcd server
npm install
cd ..The MongoDB connection is already configured in server/.env:
MONGODB_URI=mongodb://admin:productdb2025@localhost:27017/products?authSource=adminMake sure your MongoDB server is running with these credentials.
Run this script to create initial users and sample data:
cd server
node seed.js
cd ..Terminal 1 - Backend Server:
cd server
npm run devThe API will run on http://localhost:3000
Terminal 2 - Angular Frontend:
npm startThe application will run on http://localhost:4200
First install concurrently:
npm install --save-dev concurrentlyThen run:
npm run devAfter seeding the database, use these credentials:
Admin Account:
- Username:
admin - Password:
admin123 - Full access to all features
Manager Account:
- Username:
manager - Password:
manager123 - Access to management features
Cashier Account:
- Username:
cashier - Password:
cashier123 - Access to POS and sales features
- Click the "π· Camera" button in the POS interface
- Allow camera access when prompted
- Point the camera at a barcode
- The product will be automatically added to the cart
- Open the app in a mobile browser (Chrome/Safari recommended)
- The camera scanner works best on mobile devices
- Use the rear camera for better barcode recognition
The system supports digital scales via Web Serial API:
- Connect your digital scale via USB
- Click the "βοΈ Scale" button in POS
- Select your scale from the device list
- The weight will be displayed in real-time
- Products marked "requiresScale" will use the current weight
Supported Browsers: Chrome, Edge (v89+)
pdev/
βββ src/ # Angular frontend
β βββ app/
β β βββ components/ # UI components
β β β βββ login/ # Login page
β β β βββ pos/ # Main POS interface
β β β βββ products/ # Product management
β β β βββ categories/ # Category management
β β β βββ sales/ # Sales history
β β β βββ users/ # User management
β β β βββ providers/ # Provider management
β β β βββ templates/ # Print templates
β β β βββ settings/ # Settings
β β βββ services/ # Angular services
β β βββ guards/ # Route guards
β β βββ interceptors/ # HTTP interceptors
β β βββ models/ # TypeScript interfaces
β βββ environments/ # Environment configs
β βββ assets/ # Static assets
βββ server/ # Node.js backend
β βββ config/ # Database configuration
β βββ models/ # Mongoose models
β βββ routes/ # API routes
β βββ middleware/ # Express middleware
β βββ utils/ # Utility functions
β βββ index.js # Server entry point
βββ README.md
PORT=3000
MONGODB_URI=mongodb://admin:productdb2025@localhost:27017/products?authSource=admin
JWT_SECRET=your_jwt_secret_key_change_this_in_production
JWT_EXPIRE=7d
NODE_ENV=developmentDevelopment (environment.ts):
export const environment = {
production: false,
apiUrl: "http://localhost:3000/api",
};Production (environment.prod.ts):
export const environment = {
production: true,
apiUrl: "/api",
};POST /api/auth/login- User loginPOST /api/auth/register- User registration
GET /api/products- Get all productsGET /api/products/:id- Get product by IDGET /api/products/barcode/:barcode- Get product by barcodePOST /api/products- Create productPUT /api/products/:id- Update productDELETE /api/products/:id- Delete product
GET /api/categories- Get all categoriesPOST /api/categories- Create categoryPUT /api/categories/:id- Update categoryDELETE /api/categories/:id- Delete category
GET /api/sales- Get all salesGET /api/sales/:id- Get sale by IDPOST /api/sales- Create salePUT /api/sales/:id/cancel- Cancel saleGET /api/sales/reports/summary- Get sales summary
GET /api/users- Get all users (Admin/Manager)PUT /api/users/:id- Update userDELETE /api/users/:id- Delete user
GET /api/providers- Get all providersPOST /api/providers- Create providerPUT /api/providers/:id- Update providerDELETE /api/providers/:id- Delete provider
GET /api/templates- Get all templatesGET /api/templates/default- Get default templatePOST /api/templates- Create templatePUT /api/templates/:id- Update templateDELETE /api/templates/:id- Delete template
- admin: Full system access
- manager: Management and reporting access
- cashier: POS and basic sales access
- employee: Limited access
sales- Process sales transactionsrefunds- Cancel/refund salesdiscounts- Apply discountsreports- View reportsinventory- Manage products/categoriesusers- Manage userssettings- System settings
- Navigate to Categories page
- Click "Add Category"
- Set name, color, and icon
- Assign parent category (optional)
- Go to Templates page
- Create new template
- Customize header, body, and footer
- Set as default template
- Navigate to Products page
- Click "Add Product"
- Fill in product details
- Assign category and provider
- Set pricing and stock information
ng build --configuration productionDeploy the dist/ folder to your web server.
cd server
npm startUse PM2 for production:
npm install -g pm2
pm2 start index.js --name pos-api
pm2 save
pm2 startup- Verify MongoDB is running:
mongosh - Check credentials in
.envfile - Ensure network connectivity
- Use HTTPS (required for camera access)
- Check browser permissions
- Verify html5-qrcode library is loaded
- Use Chrome or Edge browser
- Enable Web Serial API in browser flags
- Check USB connection
- Clear cache:
npm cache clean --force - Delete
node_modulesand reinstall - Check Angular CLI version
- Customer management and loyalty programs
- Multiple store locations support
- Advanced inventory management
- Purchase order system
- Barcode label printing
- Mobile app (React Native/Flutter)
- Cloud deployment guides
- Offline mode support
- Multi-language support
- Email/SMS receipts
MIT License - feel free to use this project for commercial purposes.
For issues or questions:
- Check the troubleshooting section
- Review the API documentation
- Check MongoDB connection logs
- Verify all dependencies are installed
Your POS system is now configured for LAN access, allowing multiple devices (tablets, phones, other PCs) to connect simultaneously!
# Start both servers
cd c:\Users\IRWIN\Documents\pdev
.\start-pos.ps1
# Configure firewall (once, as Administrator)
.\setup-firewall.ps1- Your Network IP:
192.168.160.1 - From this PC: http://localhost:4200
- From any device on your network: http://192.168.160.1:4200
- β Auto-Focus Search Bar - Focuses automatically for barcode scanning
- β Fuzzy Search - Tolerates misspellings with Levenshtein distance
- β 300ms Debounce - Prevents excessive API calls
- β LAN Binding - Server accessible on all network interfaces
- β 16,994 Grocery Products - Pre-loaded product database
SETUP_COMPLETE.md- Complete setup and testing guideLAN_ACCESS.md- Detailed LAN configuration documentationTHEME.md- Theme system customization guide
- Can't access from other devices? Run
.\setup-firewall.ps1as Administrator - IP changed? Update
src/environments/environment.ts - Check status:
netstat -ano | findstr "3001 4200"
Built with:
- Angular 21 - Frontend framework with standalone components
- Node.js & Express - Backend API with fuzzy search
- MongoDB - Database with 16,994 products
- html5-qrcode - Barcode scanning
- Web Serial API - Scale integration
- Docker - MongoDB containerization
Happy Selling! ππ°