Your POS system is now ready for LAN access from any device on your network!
-
✅ Backend Server (Node.js)
- Configured to listen on
0.0.0.0(all network interfaces) - Port: 3001
- File:
server/index.js
- Configured to listen on
-
✅ Frontend (Angular)
- Configured with
--host 0.0.0.0 --disable-host-checkflags - Port: 4200
- File:
package.json(start script)
- Configured with
-
✅ Environment Configuration
- Updated API URLs to use LAN IP:
192.168.160.1 - File:
src/environments/environment.ts
- Updated API URLs to use LAN IP:
-
✅ Search Input Auto-Focus
- Focuses on component load
- Focuses after switching sale tabs
- Focuses after adding products to cart
- File:
src/app/components/pos/pos.component.ts
Run the quick start script:
cd c:\Users\IRWIN\Documents\pdev
.\start-pos.ps1This will:
- Check and start MongoDB if needed
- Start both backend and frontend servers
- Display access URLs
Terminal 1 - Backend:
cd c:\Users\IRWIN\Documents\pdev\server
node index.jsTerminal 2 - Frontend:
cd c:\Users\IRWIN\Documents\pdev
npm startRun this script as Administrator (one-time setup):
cd c:\Users\IRWIN\Documents\pdev
.\setup-firewall.ps1Or manually configure in Windows Defender Firewall:
- Allow TCP Port 3001 (Backend)
- Allow TCP Port 4200 (Frontend)
| Service | Local URL | LAN URL |
|---|---|---|
| Frontend | http://localhost:4200 | http://192.168.160.1:4200 |
| Backend API | http://localhost:3001/api | http://192.168.160.1:3001/api |
| Product Images | http://localhost:3001/product_images | http://192.168.160.1:3001/product_images |
- Ensure both servers are running on your main PC
- Connect your device (phone/tablet/laptop) to the same WiFi network
- Open a web browser on the device
- Navigate to:
http://192.168.160.1:4200 - You should see the POS login screen
Can't access from other devices?
- ✅ Check firewall rules (run
setup-firewall.ps1as admin) - ✅ Verify both devices are on the same network
- ✅ Ping the server:
ping 192.168.160.1 - ✅ Check if servers are running:
netstat -ano | findstr "3001 4200"
IP address changed?
- Run:
ipconfig | findstr IPv4 - Update
src/environments/environment.tswith new IP
The search bar now automatically receives focus in these scenarios:
- On Initial Load - Ready for barcode scanning immediately
- After Tab Switch - When switching between sale tabs
- After Product Add - After adding a product to the cart
This ensures seamless barcode scanning workflow!
┌─────────────────────────────────────────────────┐
│ Your WiFi Network (192.168.160.x) │
│ │
│ ┌────────────────────────────────────────────┐ │
│ │ Main PC (192.168.160.1) │ │
│ │ │ │
│ │ ┌──────────────┐ ┌──────────────┐ │ │
│ │ │ Node.js │ │ Angular │ │ │
│ │ │ :3001 │◄───┤ :4200 │ │ │
│ │ │ (Backend) │ │ (Frontend) │ │ │
│ │ └──────────────┘ └──────────────┘ │ │
│ │ ▲ ▲ │ │
│ │ │ │ │ │
│ │ └────────┬───────────┘ │ │
│ └──────────────────┼─────────────────────────┘ │
│ │ │
│ ┌───────────────┼───────────────┐ │
│ │ │ │ │
│ ┌──▼────┐ ┌─────▼────┐ ┌────▼───┐ │
│ │ Tablet│ │ Phone │ │ Laptop │ │
│ │ POS │ │ POS │ │ POS │ │
│ └───────┘ └──────────┘ └────────┘ │
│ │
│ All access via: http://192.168.160.1:4200 │
└─────────────────────────────────────────────────┘
- Main Counter: Desktop PC running the backend
- Checkout 1: Tablet accessing via LAN
- Checkout 2: Another tablet/phone via LAN
- Mobile Sales: Phone with Bluetooth barcode scanner
- ✅ Multiple cashiers can operate simultaneously
- ✅ All data syncs through MongoDB on the main PC
- ✅ Tablets/phones don't need to run the backend
- ✅ Barcode scanners work seamlessly with auto-focus
- ✅ Real-time inventory updates across all devices
| File | Purpose |
|---|---|
LAN_ACCESS.md |
Detailed LAN configuration guide |
setup-firewall.ps1 |
Firewall configuration script (run as admin) |
start-pos.ps1 |
Quick start script for both servers |
src/environments/environment.ts |
API and image URL configuration |
server/index.js |
Backend server with LAN binding |
package.json |
Frontend start command with LAN flags |
- ✅ Perfect for local network testing
- ✅ No authentication on network level
- ✅ Uses
--disable-host-checkfor any hostname access
When going live with customers:
- 🔒 Enable HTTPS/SSL
- 🔒 Add user authentication
- 🔒 Configure proper CORS policies
- 🔒 Remove
--disable-host-check - 🔒 Use environment-specific builds
- 🔒 Set up reverse proxy (nginx)
- 🔒 Implement rate limiting
- 🔒 Add network segmentation
- ✅ Run
setup-firewall.ps1as Administrator - ✅ Run
start-pos.ps1to start both servers - ✅ Test access from another device
- ✅ Set up tablets/phones for POS operation
- ⬜ Product management interface
- ⬜ User management system
- ⬜ Receipt printing templates
- ⬜ Reports and analytics
- ⬜ Discount management
- ⬜ Digital scale integration
- ⬜ Customer display screen
- ⬜ End-of-day cash reconciliation
Verify servers are running:
# Check backend
curl http://192.168.160.1:3001/api/health
# Check frontend (should return HTML)
curl http://192.168.160.1:4200Check port bindings:
netstat -ano | findstr "3001 4200"(Get-NetIPAddress -AddressFamily IPv4 | Where-Object {
$_.InterfaceAlias -notlike "*Loopback*" -and
$_.IPAddress -notlike "169.254.*"
} | Select-Object -First 1).IPAddressYou'll know everything is working when:
✅ Backend logs show: LAN: http://192.168.160.1:3001
✅ Frontend shows: Angular Live Development Server is listening on 0.0.0.0:4200
✅ You can access the POS from another device's browser
✅ Search bar is automatically focused and ready for input
✅ Product images load correctly from all devices
✅ Barcode scanning works seamlessly
Your POS system is now ready for multi-device operation! 🎉
Test it from your phone or tablet to verify LAN access is working correctly.