Spaces:
Sleeping
Sleeping
Demo Mode Instructions
This document provides instructions for using the demo mode feature that bypasses customer authentication for demonstration purposes.
Overview
Demo mode allows seamless access to the customer interface without requiring phone authentication. When enabled, accessing /customer
will automatically redirect to the menu page with pre-configured demo credentials.
Features
- Automatic Redirect: Visiting
/customer
automatically redirects to the menu with demo credentials - Demo Customer: Uses hardcoded customer ID (999999) with username "Demo Customer"
- Demo Indicator: Shows "🎭 DEMO MODE ACTIVE" badge in the menu header
- Preserved Functionality: All menu features work normally (ordering, cart, etc.)
- Easy Toggle: Simple configuration flag to enable/disable
How to Enable Demo Mode
1. Frontend Configuration
Edit frontend/src/config/demoConfig.js
:
export const DEMO_CONFIG = {
ENABLED: true, // Set to true to enable demo mode
// ... rest of config
};
2. Backend Configuration
Edit app/routers/customer.py
:
DEMO_MODE_ENABLED = True # Set to True to enable demo mode
How to Disable Demo Mode
1. Frontend Configuration
Edit frontend/src/config/demoConfig.js
:
export const DEMO_CONFIG = {
ENABLED: false, // Set to false to disable demo mode
// ... rest of config
};
2. Backend Configuration
Edit app/routers/customer.py
:
DEMO_MODE_ENABLED = False # Set to False to disable demo mode
Demo Credentials
When demo mode is active, the following credentials are used:
- Customer ID: 999999
- Username: Demo Customer
- Phone: +91-DEMO-USER
- Table Number: 1
- Unique ID: DEMO-SESSION-ID
- Visit Count: 5 (shows as returning customer)
Usage Instructions
For Demos
- Enable demo mode using the configuration above
- Start the application (both frontend and backend)
- Navigate to
http://localhost:3000/customer
- Automatic redirect to menu page with demo credentials
- Demo indicator will be visible in the header
- Use normally - all features work as expected
After Demo
- Disable demo mode using the configuration above
- Restart the application to apply changes
- Normal authentication will be required again
Technical Details
Files Modified
frontend/src/config/demoConfig.js
- Demo configurationfrontend/src/pages/customer/Login.js
- Auto-redirect logicfrontend/src/pages/customer/components/HeroBanner.js
- Demo indicatorfrontend/src/services/api.js
- Demo login APIapp/routers/customer.py
- Demo login endpoint
API Endpoint
- POST
/customer/api/demo-login
- Creates or returns demo customer with ID 999999
- Only works when
DEMO_MODE_ENABLED = True
Security Notes
- Demo mode should NEVER be enabled in production
- Demo customer ID (999999) is designed to avoid conflicts
- All demo data is clearly marked and identifiable
- Easy to clean up demo data if needed
Troubleshooting
Demo Mode Not Working
- Check both frontend and backend configuration flags
- Restart both frontend and backend servers
- Clear browser cache and localStorage
- Check browser console for errors
Demo Customer Not Created
- Ensure backend demo mode is enabled
- Check database connectivity
- Verify hotel/database selection is working
- Check backend logs for errors
Normal Authentication Still Required
- Verify frontend demo mode is enabled
- Check that
isDemoModeEnabled()
returns true - Restart frontend development server
- Clear browser cache
Reverting Changes
To completely remove demo mode functionality:
- Delete
frontend/src/config/demoConfig.js
- Remove demo imports from Login.js and HeroBanner.js
- Remove demo login endpoint from customer.py
- Remove demo login method from api.js
- Restart both servers
This ensures a clean codebase without any demo-related code.