A comprehensive digital restaurant management system with real-time order tracking, waiter notifications, and customer self-service capabilities.
- ποΈ Architecture Overview
- βοΈ Load Balancing Algorithm
- π¨ Visual Design & Theme
- π Python Backend Stack
- βοΈ React Frontend Stack
- π Twilio Integration
- π Missed Call System
- π Deployment
- π§ Development Setup
SpiceHub is a full-stack restaurant management system that solves common restaurant operational challenges through intelligent automation and real-time communication.
- Digital Menu: Customer self-service ordering via QR codes
- Real-time Order Tracking: Live status updates for customers
- Waiter Management: Automatic order assignment and capacity management
- Smart Notifications: WhatsApp alerts and missed call notifications
- Load Balancing: Intelligent waiter assignment based on current workload
- Mobile Responsive: Optimized for all device sizes
- Chalkboard Theme: High-end restaurant aesthetic with custom background
- Image Slideshows: Dynamic content presentation in Hero and Brand sections
- Missed Call System: Automatic tracking of failed waiter notifications
- Enhanced UI: Glassmorphism effects and floating ingredient elements
The system implements an intelligent load balancing algorithm to ensure fair and efficient waiter assignment:
# Find first available waiter with capacity
available_waiter = Waiter.objects.filter(
current_orders__lt=models.F('max_capacity')
).first()-
Capacity Check:
- Filters waiters where
current_orders < max_capacity - Uses Django's
F()expression for atomic comparison
- Filters waiters where
-
Priority Assignment:
- Selects the first available waiter (FIFO order)
- Ensures fair distribution among available staff
-
Atomic Update:
- Increments waiter's
current_orderscount - Saves order with assigned waiter reference
- All operations in single database transaction
- Increments waiter's
- Fair Distribution: Prevents overloading individual waiters
- Automatic Scaling: Handles varying restaurant traffic
- Real-time Capacity: Live updates of waiter availability
- Failover Protection: System gracefully handles busy periods
Waiter A: current_orders=2, max_capacity=3 β
Available
Waiter B: current_orders=3, max_capacity=3 β Full
Waiter C: current_orders=1, max_capacity=3 β
Available
Result: Waiter A gets the next order (FIFO priority)
- Django 6.0.4: Web framework for robust API development
- Django REST Framework 3.17.1: RESTful API with serialization
- Django CORS Headers 4.9.0: Cross-origin resource sharing
- Twilio 9.10.5: WhatsApp and Voice API integration
- SQLite: Default database (easily configurable for PostgreSQL/MySQL)
GET /api/waiters/- List all waitersGET /api/waiters/available/- Get available waiters onlyGET /api/waiters/{id}/- Get specific waiter details
GET /api/orders/- List all ordersPOST /api/orders/- Create new orderGET /api/orders/{id}/- Get order detailsPOST /api/orders/{id}/accept_order/- Accept orderPOST /api/orders/{id}/complete_order/- Complete order
GET /api/categories/- List menu categoriesGET /api/menu-items/- List all menu itemsGET /api/menu-items/?category={id}- Filter by category
class Waiter(models.Model):
name = models.CharField(max_length=100)
phone_number = models.CharField(max_length=20)
max_capacity = models.IntegerField(default=3)
current_orders = models.IntegerField(default=0)
is_available = models.BooleanField(default=True)class Order(models.Model):
STATUS_CHOICES = [
('Pending', 'Pending'),
('Accepted', 'Accepted'),
('Completed', 'Completed'),
]
table_number = models.IntegerField()
items = models.JSONField()
total_price = models.DecimalField(max_digits=10, decimal_places=2)
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='Pending')
assigned_waiter = models.ForeignKey(Waiter, on_delete=models.SET_NULL, null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)SpiceHub features a sophisticated chalkboard aesthetic that creates a premium dining atmosphere:
- Dark Charcoal Background:
#121212base color for authentic chalkboard appearance - Chalk Dust Texture: Subtle radial gradients simulate natural chalk residue
- Glassmorphism Cards: Semi-transparent backgrounds with backdrop blur effects
- Floating Ingredients: Animated SVG elements (chili, tomato, herbs, pepper) in screen corners
- Custom Background: Full-screen background image with 70% opacity for visual depth
/* Chalkboard container with texture */
.chalkboard-container {
position: relative;
z-index: 1;
}
/* Chalk dust overlay effect */
.chalkboard-container::before {
background:
radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.02) 0%, transparent 40%);
}
/* Glassmorphism cards */
.chalkboard-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.3);
}- Hero Section: Auto-rotating images every 3 seconds (tablet view)
- Brand Showcase: Restaurant imagery with 4-second intervals and slide indicators
- Smooth Transitions: CSS opacity transitions for professional appearance
- React 18: Modern UI library with hooks
- React Router DOM: Client-side routing
- Framer Motion: Smooth animations and transitions
- Tailwind CSS: Utility-first CSS framework
- Axios: HTTP client for API communication
- Hero Section: Animated landing with call-to-action
- CategoryGrid: Horizontal scrollable categories with fade-in animations
- ProductCard: Menu items with add-to-cart functionality
- CheckoutModal: Responsive checkout with waiter selection
- OrderTracking: Real-time order progress visualization
- WaiterDashboard: Order management interface
- Real-time Updates: 30-second polling for live data
- Order Actions: Accept/Complete order functionality
- Staggered Animations: Category cards fade-in sequentially
- Pulsing Effects: Active order tracking steps
- Smooth Transitions: Mobile menu slide animations
- Hover States: Interactive feedback throughout
- Mobile First: Optimized for phones and tablets
- Breakpoints:
- Mobile:
grid-cols-1 - Tablet:
sm:grid-cols-2 - Desktop:
lg:grid-cols-4
- Mobile:
- Touch Targets: 44px minimum button sizes
- Flexible Layouts: Adapts to all screen sizes
Traditional restaurants struggle with communication in noisy kitchen environments. SpiceHub solves this using Twilio's Voice API with intelligent missed call notifications.
- Loud kitchen environments make verbal notifications unreliable
- Waiters may miss critical order alerts
- Inconsistent communication leads to delayed service
# TwiML for missed call notification
twiml_response = VoiceResponse()
twiml_response.play(digits="9") # Beep sound
twiml_response.pause(length=3) # 3-second pause
twiml_response.append(Hangup()) # Automatic hangup
# Initiate call
voice_call = client.calls.create(
twiml=str(twiml_response),
from_=settings.TWILIO_PHONE_NUMBER,
to=waiter.phone_number,
timeout=10
)- Order Placement: Customer places order via digital menu
- Waiter Assignment: System assigns available waiter
- WhatsApp Alert: Detailed order information sent via WhatsApp
- Missed Call: 5-second call creates immediate attention
- Visual Cue: Missed call notification on waiter's phone
- Order Details: Waiter checks WhatsApp for full order information
- Reliable: Works in any noise level
- Non-Intrusive: No answering required
- Instant: Immediate visual notification
- Detailed: WhatsApp provides complete order information
- Professional: Modern communication standard
Incoming Call β Beep Sound β 3 Second Pause β Hangup (2 rings total)
β
Missed Call Notification
β
Waiter Checks WhatsApp for Order Details
SpiceHub includes a comprehensive missed call tracking system that monitors and manages failed waiter notifications:
class MissedCall(models.Model):
waiter = models.ForeignKey(Waiter, on_delete=models.CASCADE)
order = models.ForeignKey(Order, on_delete=models.CASCADE, null=True, blank=True)
phone_number = models.CharField(max_length=20)
call_sid = models.CharField(max_length=100, blank=True)
call_status = models.CharField(max_length=50, default='failed')
reason = models.CharField(max_length=200, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
resolved = models.BooleanField(default=False)
resolved_at = models.DateTimeField(null=True, blank=True)- Automatic Tracking: Failed Twilio calls automatically create missed call records
- Real-time Notifications: Live missed call display in management interface
- Resolution Tracking: Mark calls as resolved when handled
- Detailed Logging: Complete error reasons and timestamps
- Waiter Performance: Track missed calls per waiter for optimization
GET /api/missed-calls/- List all missed callsGET /api/missed-calls/unresolved/- Get only unresolved missed callsPOST /api/missed-calls/{id}/resolve/- Mark missed call as resolved
// Real-time missed call notifications
<MissedCalls />- Fixed position overlay (top-right corner)
- Chalkboard theme matching design
- One-click resolution functionality
- Auto-refresh every 30 seconds
- Accountability: Track communication failures
- Performance Metrics: Monitor waiter responsiveness
- Problem Resolution: Quick identification of issues
- Customer Service: Ensure no orders are missed
# Install dependencies
pip install -r requirements.txt
# Environment Variables
export TWILIO_ACCOUNT_SID="your_sid"
export TWILIO_AUTH_TOKEN="your_token"
export TWILIO_PHONE_NUMBER="+1234567890"
# Deploy
git push heroku main# Build for production
npm run build
# Deploy
npm run deployrequirements.txt- Python dependenciesProcfile- Heroku deployment configurationpackage.json- Node.js dependenciestailwind.config.js- Tailwind CSS configuration
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run migrations
python manage.py makemigrations
python manage.py migrate
# Start development server
python manage.py runserver# Install dependencies
npm install
# Start development server
npm run dev# Generate QR codes for restaurant tables
python generate_qr.py --url http://localhost:5173 --all
# Generate specific table QR code
python generate_qr.py --url http://localhost:5173 --table 1- QR Code Access: Scan table QR code to open digital menu
- Real-time Tracking: Live order status updates
- Mobile Optimized: Works perfectly on smartphones
- Instant Feedback: Order confirmation and tracking
- Load Balancing: Fair waiter assignment
- Real-time Notifications: WhatsApp and missed call alerts
- Capacity Management: Automatic availability tracking
- Order Management: Complete order lifecycle tracking
- Scalable Architecture: Handles high traffic volumes
- Real-time Updates: Live data synchronization
- Error Handling: Graceful failure recovery
- Security Best Practices: Protected API endpoints
For technical support or questions about the SpiceHub system, please refer to the development documentation or contact the development team.
Built with β€οΈ for modern restaurants