Get running in 5 minutes
This guide will get you from zero to a working TableOrder app with both modes functional.Install and configure
Follow the installation guide to set up your development environment. At minimum, you need:
You must have a valid Mapbox token. Get one free at account.mapbox.com.
Launch the app
Start the development server and run on your device:The app will launch and request location permissions. Grant them to continue.
Test scanner mode
When the app opens, you’ll see an interactive map with your current location marked. To test scanner mode:
- Tap a location on the map within 50 meters of your current position (simulating being inside the restaurant)
- The app automatically switches to Scanner Mode
- The QR scanner activates with camera preview
Scan a test QR code
Use one of these test QR codes to simulate scanning a table:After scanning, the contextual menu loads automatically based on the table type.
Add items to cart
Browse the menu and add items:
- Tap any product card to view details
- Tap “Add to cart” to add items
- Adjust quantities using + and - buttons
- Navigate to cart using the bottom tab bar
- Subtotal
- Discount (if birthday table)
- Final total
Complete checkout
Process a test payment:
- Tap “Proceed to Payment” in the cart
- Review your order summary
- Tap “Pay Now” to trigger the mock payment flow
- 2-second payment simulation with loading state
- Success notification with haptic feedback
- PDF receipt auto-generated
- Receipt sent to Telegram (if configured)
- Push notification delivered
The payment service is mocked for testing. To integrate real Stripe payments, add
EXPO_PUBLIC_STRIPE_KEY to your .env file.Test delivery mode
Return to the map and test delivery flow:
- Tap the home icon to return to the context switcher
- Tap a location on the map farther than 50 meters from your position
- The app automatically switches to Delivery Mode
- You’re redirected to the full delivery catalog
- Full product catalog (all items available)
- Per-kilometer shipping cost calculated via Mapbox Directions API
- Real-time distance and ETA display
- Post-payment route tracking with polyline visualization
View route tracking
After completing a delivery order:
- Payment processes successfully
- App automatically navigates to Track Order screen
- Interactive map displays:
- Your location (delivery destination)
- Restaurant location (pickup point)
- Driving route polyline
- Distance in kilometers
- Estimated delivery time
Understanding the code
How GPS mode detection works
The app uses Haversine formula to calculate distance between user and restaurant:src/components/location/ContextSwitcher.tsx
src/components/location/ContextSwitcher.tsx
The geofence radius (default: 50m) is configurable in
src/lib/core/config.ts:20.How contextual menus work
Tables have different types that filter the available menu:src/lib/core/types.ts
src/lib/modules/menu/useMenuLogic.ts
How state management works
TableOrder uses Zustand for global state with three stores:- Location Store
- Table Store
- Cart Store
src/stores/useLocationStore.ts
Zustand provides zero-boilerplate state management without Provider components. Components re-render only when their selected slice changes.
Test QR codes reference
All available test codes for scanner mode:| QR Code | Table Name | Menu Type | Special Effect |
|---|---|---|---|
TABLE_BAR_01 | Barra 01 | Drinks only | None |
TABLE_HALL_05 | Salón 05 | Full menu | None |
TABLE_BDAY_99 | Mesa Especial | Full menu | Birthday banner + 15% discount |
Common workflows
Adding new products
Edit the products array insrc/lib/core/mockData.ts:
src/lib/core/mockData.ts
Adjusting geofence radius
Modify the configuration insrc/lib/core/config.ts:
src/lib/core/config.ts
Customizing shipping costs
Update the cost multiplier insrc/lib/core/config.ts:
src/lib/core/config.ts
Next steps
Architecture guide
Understand the feature-based structure and design patterns
API reference
Explore services, stores, and utility functions
Core features
Learn about table mode and delivery mode
Configuration
Configure Mapbox, Stripe, and Telegram