Spaces:
Sleeping
Sleeping
Fix README.md Hugging Face Spaces metadata configuration
Browse files
README.md
CHANGED
|
@@ -1,937 +1,209 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
-
|
| 14 |
-
-
|
| 15 |
-
-
|
| 16 |
-
-
|
| 17 |
-
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
- **
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
```
|
| 48 |
-
|
| 49 |
-
2. **Create database** (optional - auto-created on first access):
|
| 50 |
-
```bash
|
| 51 |
-
python create_empty_db.py
|
| 52 |
-
```
|
| 53 |
-
|
| 54 |
-
3. **Restart your Space** to apply changes
|
| 55 |
-
|
| 56 |
-
### π± Usage Guide
|
| 57 |
-
|
| 58 |
-
#### For Customers:
|
| 59 |
-
1. Scan QR code at your table or visit `/customer`
|
| 60 |
-
2. Select your hotel and enter access code
|
| 61 |
-
3. Enter table number and phone number
|
| 62 |
-
4. Verify OTP and start ordering!
|
| 63 |
-
|
| 64 |
-
#### For Restaurant Staff:
|
| 65 |
-
- **Chefs**: Visit `/chef` for order management
|
| 66 |
-
- **Admins**: Visit `/admin` for complete restaurant control
|
| 67 |
-
- **API**: Visit `/docs` for API documentation
|
| 68 |
-
|
| 69 |
-
## π Key Features
|
| 70 |
-
|
| 71 |
-
### π½οΈ Customer Interface
|
| 72 |
-
- **Phone OTP Authentication**: Secure Firebase-based authentication
|
| 73 |
-
- **Real-time Cart Management**: Live cart updates with special offers
|
| 74 |
-
- **Today's Specials**: Dynamic special dish recommendations
|
| 75 |
-
- **Payment Processing**: Integrated payment with loyalty discounts
|
| 76 |
-
- **Order History**: Track past orders and preferences
|
| 77 |
-
|
| 78 |
-
### π¨βπ³ Chef Dashboard
|
| 79 |
-
- **Real-time Order Management**: Live order notifications and updates
|
| 80 |
-
- **Kitchen Operations**: Streamlined order acceptance and completion
|
| 81 |
-
- **Order Status Updates**: Instant status changes reflected across all interfaces
|
| 82 |
-
|
| 83 |
-
### π¨ Admin Panel
|
| 84 |
-
- **Complete Restaurant Management**: Full control over restaurant operations
|
| 85 |
-
- **Dish Management**: Add, edit, and manage menu items with images
|
| 86 |
-
- **Offers & Specials**: Create and manage promotional offers
|
| 87 |
-
- **Table Management**: Monitor table occupancy and status
|
| 88 |
-
- **Order Tracking**: Complete order lifecycle management
|
| 89 |
-
- **Loyalty Program**: Configurable visit-based discount system
|
| 90 |
-
- **Selection Offers**: Amount-based discount configuration
|
| 91 |
-
- **Settings**: Hotel information and configuration management
|
| 92 |
-
|
| 93 |
-
### π Analytics Dashboard
|
| 94 |
-
- **Customer Analysis**: Detailed customer behavior insights
|
| 95 |
-
- **Dish Performance**: Menu item popularity and sales metrics
|
| 96 |
-
- **Chef Performance**: Kitchen efficiency tracking
|
| 97 |
-
- **Sales & Revenue**: Comprehensive financial reporting
|
| 98 |
-
|
| 99 |
-
### ποΈ Multi-Database Support
|
| 100 |
-
- **Independent Hotel Operations**: Each hotel operates with its own database
|
| 101 |
-
- **Database Authentication**: Secure database access with password protection
|
| 102 |
-
- **Session-based Management**: Consistent database context across all interfaces
|
| 103 |
-
- **Data Isolation**: Complete separation of hotel data for security and privacy
|
| 104 |
-
|
| 105 |
-
## π Project Structure
|
| 106 |
-
|
| 107 |
-
```
|
| 108 |
-
tabble/
|
| 109 |
-
βββ app/ # Backend FastAPI application
|
| 110 |
-
β βββ database.py # Database configuration and models
|
| 111 |
-
β βββ main.py # FastAPI application entry point
|
| 112 |
-
β βββ middleware/ # Custom middleware (CORS, session handling)
|
| 113 |
-
β βββ models/ # SQLAlchemy database models
|
| 114 |
-
β βββ routers/ # API route definitions
|
| 115 |
-
β β βββ admin.py # Admin panel endpoints
|
| 116 |
-
β β βββ chef.py # Chef dashboard endpoints
|
| 117 |
-
β β βββ customer.py # Customer interface endpoints
|
| 118 |
-
β β βββ analytics.py # Analytics and reporting endpoints
|
| 119 |
-
β βββ services/ # Business logic and external services
|
| 120 |
-
β β βββ firebase_service.py # Firebase authentication
|
| 121 |
-
β β βββ database_service.py # Database operations
|
| 122 |
-
β βββ static/ # Static file serving
|
| 123 |
-
β β βββ images/ # Dish and hotel logo images
|
| 124 |
-
β β βββ dishes/ # Organized by database name
|
| 125 |
-
β βββ utils/ # Utility functions and helpers
|
| 126 |
-
βββ frontend/ # React frontend application
|
| 127 |
-
β βββ src/
|
| 128 |
-
β β βββ components/ # Reusable React components
|
| 129 |
-
β β β βββ Layout.js # Main layout wrapper
|
| 130 |
-
β β β βββ AdminLayout.js # Admin panel layout
|
| 131 |
-
β β β βββ ChefLayout.js # Chef dashboard layout
|
| 132 |
-
β β βββ pages/ # Page components
|
| 133 |
-
β β β βββ admin/ # Admin interface pages
|
| 134 |
-
β β β βββ chef/ # Chef dashboard pages
|
| 135 |
-
β β β βββ customer/ # Customer interface pages
|
| 136 |
-
β β β βββ analysis/ # Analytics dashboard
|
| 137 |
-
β β βββ services/ # API communication services
|
| 138 |
-
β β β βββ api.js # Axios configuration and API calls
|
| 139 |
-
β β βββ App.js # Main React application
|
| 140 |
-
β β βββ index.js # React DOM entry point
|
| 141 |
-
β β βββ global.css # Global styling
|
| 142 |
-
β βββ public/ # Static assets
|
| 143 |
-
β β βββ index.html # HTML template
|
| 144 |
-
β β βββ favicon.ico # Application icon
|
| 145 |
-
β βββ package.json # Node.js dependencies
|
| 146 |
-
β βββ .env.example # Environment variables template
|
| 147 |
-
β βββ .env # Environment configuration
|
| 148 |
-
βββ templates/ # Report generation templates
|
| 149 |
-
β βββ analysis/ # Analytics report templates
|
| 150 |
-
βββ hotels.csv # Database registry and passwords
|
| 151 |
-
βββ init_db.py # Database initialization with sample data
|
| 152 |
-
βββ create_empty_db.py # Empty database creation utility
|
| 153 |
-
βββ requirements.txt # Python dependencies
|
| 154 |
-
βββ run.py # Backend server launcher
|
| 155 |
-
βββ README.md # Project documentation
|
| 156 |
-
```
|
| 157 |
-
|
| 158 |
-
## π Quick Start Guide
|
| 159 |
-
|
| 160 |
-
### Prerequisites
|
| 161 |
-
|
| 162 |
-
#### For Windows:
|
| 163 |
-
- **Python 3.8+**: Download from [python.org](https://www.python.org/downloads/)
|
| 164 |
-
- **Node.js 16+**: Download from [nodejs.org](https://nodejs.org/downloads/)
|
| 165 |
-
- **Git**: Download from [git-scm.com](https://git-scm.com/downloads)
|
| 166 |
-
|
| 167 |
-
#### For macOS:
|
| 168 |
-
- **Python 3.8+**: Install via Homebrew: `brew install python3`
|
| 169 |
-
- **Node.js 16+**: Install via Homebrew: `brew install node`
|
| 170 |
-
- **Git**: Install via Homebrew: `brew install git`
|
| 171 |
-
|
| 172 |
-
### π§ Installation & Setup
|
| 173 |
-
|
| 174 |
-
#### 1. Clone the Repository
|
| 175 |
-
```bash
|
| 176 |
-
git clone <repository-url>
|
| 177 |
-
cd tabble
|
| 178 |
-
```
|
| 179 |
-
|
| 180 |
-
#### 2. Backend Setup
|
| 181 |
-
|
| 182 |
-
##### Windows:
|
| 183 |
-
```cmd
|
| 184 |
-
# Create virtual environment
|
| 185 |
-
python -m venv venv
|
| 186 |
-
|
| 187 |
-
# Activate virtual environment
|
| 188 |
-
venv\Scripts\activate
|
| 189 |
-
|
| 190 |
-
# Install dependencies
|
| 191 |
-
pip install -r requirements.txt
|
| 192 |
-
```
|
| 193 |
-
|
| 194 |
-
##### macOS/Linux:
|
| 195 |
-
```bash
|
| 196 |
-
# Create virtual environment
|
| 197 |
-
python3 -m venv venv
|
| 198 |
-
|
| 199 |
-
# Activate virtual environment
|
| 200 |
-
source venv/bin/activate
|
| 201 |
-
|
| 202 |
-
# Install dependencies
|
| 203 |
-
pip install -r requirements.txt
|
| 204 |
-
```
|
| 205 |
-
|
| 206 |
-
#### 3. Frontend Setup
|
| 207 |
-
|
| 208 |
-
##### Both Windows and macOS:
|
| 209 |
-
```bash
|
| 210 |
-
# Navigate to frontend directory
|
| 211 |
-
cd frontend
|
| 212 |
-
|
| 213 |
-
# Copy environment template
|
| 214 |
-
cp .env.example .env
|
| 215 |
-
|
| 216 |
-
# Install Node.js dependencies
|
| 217 |
-
npm install
|
| 218 |
-
```
|
| 219 |
-
|
| 220 |
-
#### 4. Configure Environment Variables
|
| 221 |
-
|
| 222 |
-
##### Backend (.env in root directory):
|
| 223 |
-
```env
|
| 224 |
-
SECRET_KEY=your_secret_key_here
|
| 225 |
-
```
|
| 226 |
-
|
| 227 |
-
##### Frontend (frontend/.env):
|
| 228 |
-
```env
|
| 229 |
-
# Backend API Configuration
|
| 230 |
-
REACT_APP_API_BASE_URL=http://localhost:8000
|
| 231 |
-
|
| 232 |
-
# Development settings
|
| 233 |
-
NODE_ENV=development
|
| 234 |
-
|
| 235 |
-
# Firebase Configuration (optional)
|
| 236 |
-
# REACT_APP_FIREBASE_API_KEY=your_firebase_api_key
|
| 237 |
-
# REACT_APP_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
|
| 238 |
-
# REACT_APP_FIREBASE_PROJECT_ID=your_project_id
|
| 239 |
-
```
|
| 240 |
-
|
| 241 |
-
## ποΈ Database Management
|
| 242 |
-
|
| 243 |
-
### Understanding the Multi-Database System
|
| 244 |
-
|
| 245 |
-
Tabble supports multiple independent hotel databases, allowing each hotel to operate with complete data isolation. Each database contains:
|
| 246 |
-
|
| 247 |
-
- **Dishes**: Menu items with pricing, categories, and images
|
| 248 |
-
- **Orders**: Customer orders and order items
|
| 249 |
-
- **Persons**: Customer information and visit history
|
| 250 |
-
- **Tables**: Table management and occupancy status
|
| 251 |
-
- **Loyalty Program**: Visit-based discount tiers
|
| 252 |
-
- **Selection Offers**: Amount-based promotional offers
|
| 253 |
-
- **Settings**: Hotel-specific configuration
|
| 254 |
-
- **Feedback**: Customer reviews and ratings
|
| 255 |
-
|
| 256 |
-
### Database Registry (hotels.csv)
|
| 257 |
-
|
| 258 |
-
The `hotels.csv` file serves as the central registry for all hotel databases:
|
| 259 |
-
|
| 260 |
-
```csv
|
| 261 |
-
hotel_database,password
|
| 262 |
-
tabble_new.db,myhotel
|
| 263 |
-
```
|
| 264 |
-
|
| 265 |
-
### Creating a New Hotel Database
|
| 266 |
-
|
| 267 |
-
#### Method 1: Using the create_empty_db.py Script
|
| 268 |
-
|
| 269 |
-
##### Windows:
|
| 270 |
-
```cmd
|
| 271 |
-
# Activate virtual environment
|
| 272 |
-
venv\Scripts\activate
|
| 273 |
-
|
| 274 |
-
# Run the database creation script
|
| 275 |
-
python create_empty_db.py
|
| 276 |
-
```
|
| 277 |
-
|
| 278 |
-
##### macOS/Linux:
|
| 279 |
-
```bash
|
| 280 |
-
# Activate virtual environment
|
| 281 |
-
source venv/bin/activate
|
| 282 |
-
|
| 283 |
-
# Run the database creation script
|
| 284 |
-
python create_empty_db.py
|
| 285 |
-
```
|
| 286 |
-
|
| 287 |
-
**Interactive Process:**
|
| 288 |
-
1. The script will prompt you for a database name
|
| 289 |
-
2. Enter the hotel name (without .db extension)
|
| 290 |
-
3. The script creates an empty database with proper schema
|
| 291 |
-
4. Manually add the database entry to `hotels.csv`
|
| 292 |
-
|
| 293 |
-
**Example:**
|
| 294 |
-
```
|
| 295 |
-
Creating a new empty database with the proper schema
|
| 296 |
-
Enter name for the new database (without .db extension): newhotel
|
| 297 |
-
|
| 298 |
-
Success! Created empty database 'newhotel.db' with the proper schema
|
| 299 |
-
```
|
| 300 |
-
|
| 301 |
-
Then add to `hotels.csv`:
|
| 302 |
-
```csv
|
| 303 |
-
newhotel.db,newhotel123
|
| 304 |
-
```
|
| 305 |
-
|
| 306 |
-
#### Method 2: Initialize with Sample Data
|
| 307 |
-
|
| 308 |
-
##### Windows:
|
| 309 |
-
```cmd
|
| 310 |
-
# Create database with sample data
|
| 311 |
-
python init_db.py
|
| 312 |
-
```
|
| 313 |
-
|
| 314 |
-
##### macOS/Linux:
|
| 315 |
-
```bash
|
| 316 |
-
# Create database with sample data
|
| 317 |
-
python init_db.py
|
| 318 |
-
```
|
| 319 |
-
|
| 320 |
-
**Note:** This creates `tabble_new.db` with sample dishes, users, and configuration.
|
| 321 |
-
|
| 322 |
-
### Database Schema Details
|
| 323 |
-
|
| 324 |
-
The `create_empty_db.py` script creates the following tables:
|
| 325 |
-
|
| 326 |
-
#### Core Tables:
|
| 327 |
-
- **dishes**: Menu items with pricing, categories, offers, and visibility
|
| 328 |
-
- **persons**: Customer profiles with visit tracking
|
| 329 |
-
- **orders**: Order management with status tracking
|
| 330 |
-
- **order_items**: Individual items within orders
|
| 331 |
-
- **tables**: Table management and occupancy status
|
| 332 |
-
|
| 333 |
-
#### Configuration Tables:
|
| 334 |
-
- **loyalty_program**: Visit-based discount configuration
|
| 335 |
-
- **selection_offers**: Amount-based promotional offers
|
| 336 |
-
- **settings**: Hotel information and branding
|
| 337 |
-
- **feedback**: Customer reviews and ratings
|
| 338 |
-
|
| 339 |
-
### Running the Application
|
| 340 |
-
|
| 341 |
-
#### Start Backend Server
|
| 342 |
-
|
| 343 |
-
##### Windows:
|
| 344 |
-
```cmd
|
| 345 |
-
# Activate virtual environment
|
| 346 |
-
venv\Scripts\activate
|
| 347 |
-
|
| 348 |
-
# Start the FastAPI server
|
| 349 |
-
python run.py
|
| 350 |
-
```
|
| 351 |
-
|
| 352 |
-
##### macOS/Linux:
|
| 353 |
-
```bash
|
| 354 |
-
# Activate virtual environment
|
| 355 |
-
source venv/bin/activate
|
| 356 |
-
|
| 357 |
-
# Start the FastAPI server
|
| 358 |
-
python run.py
|
| 359 |
-
```
|
| 360 |
-
|
| 361 |
-
The backend will be available at `http://localhost:8000`
|
| 362 |
-
|
| 363 |
-
#### Start Frontend Development Server
|
| 364 |
-
|
| 365 |
-
##### Both Windows and macOS:
|
| 366 |
-
```bash
|
| 367 |
-
# Navigate to frontend directory
|
| 368 |
-
cd frontend
|
| 369 |
-
|
| 370 |
-
# Start React development server
|
| 371 |
-
npm start
|
| 372 |
-
```
|
| 373 |
-
|
| 374 |
-
The frontend will be available at `http://localhost:3000`
|
| 375 |
-
|
| 376 |
-
### π API Documentation
|
| 377 |
-
|
| 378 |
-
Once the backend is running, access the interactive API documentation:
|
| 379 |
-
- **Swagger UI**: `http://localhost:8000/docs`
|
| 380 |
-
- **ReDoc**: `http://localhost:8000/redoc`
|
| 381 |
-
|
| 382 |
-
## π― Key Features Implementation
|
| 383 |
-
|
| 384 |
-
### π½οΈ Table Management
|
| 385 |
-
- **QR Code Generation**: Automatic QR code creation for each table
|
| 386 |
-
- **Real-time Status Monitoring**: Live table occupancy tracking
|
| 387 |
-
- **Session-based Occupancy**: Table status changes based on customer interaction
|
| 388 |
-
- **Multi-database Support**: Table management per hotel database
|
| 389 |
-
|
| 390 |
-
### π± Order Processing
|
| 391 |
-
- **Real-time Order Tracking**: Live order status updates across all interfaces
|
| 392 |
-
- **Kitchen Notifications**: Instant order notifications to chef dashboard
|
| 393 |
-
- **Status Synchronization**: Order status changes reflect immediately
|
| 394 |
- **Payment Integration**: Secure payment processing with loyalty discounts
|
| 395 |
-
|
| 396 |
-
### π Analytics and Reporting
|
| 397 |
-
- **Custom Report Templates**: Configurable analytics reports
|
| 398 |
-
- **PDF Generation**: Automated report exports
|
| 399 |
-
- **Performance Metrics**: Comprehensive business intelligence
|
| 400 |
-
- **Multi-dimensional Analysis**: Customer, dish, and chef performance tracking
|
| 401 |
-
|
| 402 |
-
### π Authentication & Security
|
| 403 |
-
- **Firebase Phone OTP**: Secure customer authentication
|
| 404 |
-
- **Database Password Protection**: Hotel database access control
|
| 405 |
-
- **Session Management**: Secure session handling across interfaces
|
| 406 |
-
- **Data Isolation**: Complete separation of hotel data
|
| 407 |
-
|
| 408 |
-
## π¨ Troubleshooting
|
| 409 |
-
|
| 410 |
-
### Common Issues
|
| 411 |
-
|
| 412 |
-
#### Backend Issues:
|
| 413 |
-
```bash
|
| 414 |
-
# If you get "Module not found" errors
|
| 415 |
-
pip install -r requirements.txt
|
| 416 |
-
|
| 417 |
-
# If database connection fails
|
| 418 |
-
python create_empty_db.py
|
| 419 |
-
|
| 420 |
-
# If port 8000 is already in use
|
| 421 |
-
# Edit run.py and change the port number
|
| 422 |
-
```
|
| 423 |
-
|
| 424 |
-
#### Frontend Issues:
|
| 425 |
-
```bash
|
| 426 |
-
# If npm install fails
|
| 427 |
-
npm cache clean --force
|
| 428 |
-
npm install
|
| 429 |
-
|
| 430 |
-
# If environment variables aren't loading
|
| 431 |
-
# Check that .env file exists in frontend directory
|
| 432 |
-
cp .env.example .env
|
| 433 |
-
|
| 434 |
-
# If API calls fail
|
| 435 |
-
# Verify REACT_APP_API_BASE_URL in frontend/.env
|
| 436 |
-
```
|
| 437 |
-
|
| 438 |
-
#### Database Issues:
|
| 439 |
-
```bash
|
| 440 |
-
# If database schema is outdated
|
| 441 |
-
python init_db.py --force-reset
|
| 442 |
-
|
| 443 |
-
# If hotels.csv is missing entries
|
| 444 |
-
# Manually add your database to hotels.csv
|
| 445 |
-
```
|
| 446 |
-
|
| 447 |
-
### Platform-Specific Notes
|
| 448 |
-
|
| 449 |
-
#### Windows:
|
| 450 |
-
- Use `venv\Scripts\activate` to activate virtual environment
|
| 451 |
-
- Use `python` command (not `python3`)
|
| 452 |
-
- Ensure Python is added to PATH during installation
|
| 453 |
-
|
| 454 |
-
#### macOS:
|
| 455 |
-
- Use `source venv/bin/activate` to activate virtual environment
|
| 456 |
-
- Use `python3` command for Python 3.x
|
| 457 |
-
- Install Xcode Command Line Tools if needed: `xcode-select --install`
|
| 458 |
-
|
| 459 |
-
## π Development Workflow
|
| 460 |
-
|
| 461 |
-
### Adding a New Hotel Database
|
| 462 |
-
|
| 463 |
-
1. **Create Empty Database:**
|
| 464 |
-
```bash
|
| 465 |
-
python create_empty_db.py
|
| 466 |
-
```
|
| 467 |
-
|
| 468 |
-
2. **Add to Registry:**
|
| 469 |
-
Edit `hotels.csv` and add your database entry:
|
| 470 |
-
```csv
|
| 471 |
-
yourhotel.db,yourpassword123
|
| 472 |
-
```
|
| 473 |
-
|
| 474 |
-
3. **Configure Hotel Settings:**
|
| 475 |
-
- Access admin panel: `http://localhost:3000/admin`
|
| 476 |
-
- Navigate to Settings
|
| 477 |
-
- Configure hotel information
|
| 478 |
-
|
| 479 |
-
4. **Add Menu Items:**
|
| 480 |
-
- Use admin panel to add dishes
|
| 481 |
-
- Upload dish images to `app/static/images/dishes/yourhotel/`
|
| 482 |
-
|
| 483 |
-
### Deployment Considerations
|
| 484 |
-
|
| 485 |
-
#### Production Environment Variables:
|
| 486 |
-
```env
|
| 487 |
-
# Backend
|
| 488 |
-
SECRET_KEY=your_production_secret_key
|
| 489 |
-
DATABASE_URL=your_production_database_url
|
| 490 |
-
|
| 491 |
-
# Frontend
|
| 492 |
-
REACT_APP_API_BASE_URL=https://your-domain.com/api
|
| 493 |
-
NODE_ENV=production
|
| 494 |
-
```
|
| 495 |
-
|
| 496 |
-
#### Image Storage:
|
| 497 |
-
- Images are stored in `app/static/images/dishes/{database_name}/`
|
| 498 |
-
- Ensure proper directory permissions for image uploads
|
| 499 |
-
- Consider using cloud storage for production deployments
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
A comprehensive restaurant management system built with FastAPI (backend) and React (frontend), featuring QR code-based table ordering, phone OTP authentication, real-time order management, and multi-database support for independent hotel operations.
|
| 503 |
-
|
| 504 |
-
## π Key Features
|
| 505 |
-
|
| 506 |
-
### π½οΈ Customer Interface
|
| 507 |
-
- **Phone OTP Authentication**: Secure Firebase-based authentication
|
| 508 |
-
- **Real-time Cart Management**: Live cart updates with special offers
|
| 509 |
-
- **Today's Specials**: Dynamic special dish recommendations
|
| 510 |
-
- **Payment Processing**: Integrated payment with loyalty discounts
|
| 511 |
- **Order History**: Track past orders and preferences
|
| 512 |
|
| 513 |
-
### π¨βπ³
|
| 514 |
-
- **Real-time
|
| 515 |
-
- **
|
| 516 |
-
- **
|
| 517 |
-
|
| 518 |
-
### π¨ Admin Panel
|
| 519 |
-
- **Complete Restaurant Management**: Full control over restaurant operations
|
| 520 |
-
- **Dish Management**: Add, edit, and manage menu items with images
|
| 521 |
-
- **Offers & Specials**: Create and manage promotional offers
|
| 522 |
-
- **Table Management**: Monitor table occupancy and status
|
| 523 |
-
- **Order Tracking**: Complete order lifecycle management
|
| 524 |
-
- **Loyalty Program**: Configurable visit-based discount system
|
| 525 |
-
- **Selection Offers**: Amount-based discount configuration
|
| 526 |
-
- **Settings**: Hotel information and configuration management
|
| 527 |
-
|
| 528 |
-
### π Analytics Dashboard
|
| 529 |
-
- **Customer Analysis**: Detailed customer behavior insights
|
| 530 |
-
- **Dish Performance**: Menu item popularity and sales metrics
|
| 531 |
-
- **Chef Performance**: Kitchen efficiency tracking
|
| 532 |
-
- **Sales & Revenue**: Comprehensive financial reporting
|
| 533 |
-
|
| 534 |
-
### ποΈ Multi-Database Support
|
| 535 |
-
- **Independent Hotel Operations**: Each hotel operates with its own database
|
| 536 |
-
- **Database Authentication**: Secure database access with password protection
|
| 537 |
-
- **Session-based Management**: Consistent database context across all interfaces
|
| 538 |
-
- **Data Isolation**: Complete separation of hotel data for security and privacy
|
| 539 |
-
|
| 540 |
-
## π Project Structure
|
| 541 |
-
|
| 542 |
-
```
|
| 543 |
-
tabble/
|
| 544 |
-
βββ app/ # Backend FastAPI application
|
| 545 |
-
β βββ database.py # Database configuration and models
|
| 546 |
-
β βββ main.py # FastAPI application entry point
|
| 547 |
-
β βββ middleware/ # Custom middleware (CORS, session handling)
|
| 548 |
-
β βββ models/ # SQLAlchemy database models
|
| 549 |
-
β βββ routers/ # API route definitions
|
| 550 |
-
β β βββ admin.py # Admin panel endpoints
|
| 551 |
-
β β βββ chef.py # Chef dashboard endpoints
|
| 552 |
-
β β βββ customer.py # Customer interface endpoints
|
| 553 |
-
β β βββ analytics.py # Analytics and reporting endpoints
|
| 554 |
-
β βββ services/ # Business logic and external services
|
| 555 |
-
β β βββ firebase_service.py # Firebase authentication
|
| 556 |
-
β β βββ database_service.py # Database operations
|
| 557 |
-
β βββ static/ # Static file serving
|
| 558 |
-
β β βββ images/ # Dish and hotel logo images
|
| 559 |
-
β β βββ dishes/ # Organized by database name
|
| 560 |
-
β βββ utils/ # Utility functions and helpers
|
| 561 |
-
βββ frontend/ # React frontend application
|
| 562 |
-
β βββ src/
|
| 563 |
-
β β βββ components/ # Reusable React components
|
| 564 |
-
β β β βββ Layout.js # Main layout wrapper
|
| 565 |
-
β β β βββ AdminLayout.js # Admin panel layout
|
| 566 |
-
β β β βββ ChefLayout.js # Chef dashboard layout
|
| 567 |
-
β β βββ pages/ # Page components
|
| 568 |
-
β β β βββ admin/ # Admin interface pages
|
| 569 |
-
β β β βββ chef/ # Chef dashboard pages
|
| 570 |
-
β β β βββ customer/ # Customer interface pages
|
| 571 |
-
β β β βββ analysis/ # Analytics dashboard
|
| 572 |
-
β β βββ services/ # API communication services
|
| 573 |
-
β β β βββ api.js # Axios configuration and API calls
|
| 574 |
-
β β βββ App.js # Main React application
|
| 575 |
-
β β βββ index.js # React DOM entry point
|
| 576 |
-
β β βββ global.css # Global styling
|
| 577 |
-
β βββ public/ # Static assets
|
| 578 |
-
β β βββ index.html # HTML template
|
| 579 |
-
β β βββ favicon.ico # Application icon
|
| 580 |
-
β βββ package.json # Node.js dependencies
|
| 581 |
-
β βββ .env.example # Environment variables template
|
| 582 |
-
β βββ .env # Environment configuration
|
| 583 |
-
βββ templates/ # Report generation templates
|
| 584 |
-
β βββ analysis/ # Analytics report templates
|
| 585 |
-
βββ hotels.csv # Database registry and passwords
|
| 586 |
-
βββ init_db.py # Database initialization with sample data
|
| 587 |
-
βββ create_empty_db.py # Empty database creation utility
|
| 588 |
-
βββ requirements.txt # Python dependencies
|
| 589 |
-
βββ run.py # Backend server launcher
|
| 590 |
-
βββ README.md # Project documentation
|
| 591 |
-
```
|
| 592 |
-
|
| 593 |
-
## π Quick Start Guide
|
| 594 |
-
|
| 595 |
-
### Prerequisites
|
| 596 |
|
| 597 |
-
|
| 598 |
-
- **
|
| 599 |
-
- **
|
| 600 |
-
- **
|
|
|
|
|
|
|
|
|
|
| 601 |
|
| 602 |
-
|
| 603 |
-
- **Python 3.8+**: Install via Homebrew: `brew install python3`
|
| 604 |
-
- **Node.js 16+**: Install via Homebrew: `brew install node`
|
| 605 |
-
- **Git**: Install via Homebrew: `brew install git`
|
| 606 |
|
| 607 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 608 |
|
| 609 |
-
|
| 610 |
-
```bash
|
| 611 |
-
git clone <repository-url>
|
| 612 |
-
cd tabble
|
| 613 |
-
```
|
| 614 |
-
|
| 615 |
-
#### 2. Backend Setup
|
| 616 |
|
| 617 |
-
|
| 618 |
-
```cmd
|
| 619 |
-
# Create virtual environment
|
| 620 |
-
python -m venv venv
|
| 621 |
|
| 622 |
-
|
| 623 |
-
|
|
|
|
|
|
|
| 624 |
|
| 625 |
-
|
| 626 |
-
pip install -r requirements.txt
|
| 627 |
-
```
|
| 628 |
|
| 629 |
-
##### macOS/Linux:
|
| 630 |
```bash
|
| 631 |
-
#
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
# Activate virtual environment
|
| 635 |
-
source venv/bin/activate
|
| 636 |
|
| 637 |
# Install dependencies
|
| 638 |
pip install -r requirements.txt
|
| 639 |
-
```
|
| 640 |
-
|
| 641 |
-
#### 3. Frontend Setup
|
| 642 |
-
|
| 643 |
-
##### Both Windows and macOS:
|
| 644 |
-
```bash
|
| 645 |
-
# Navigate to frontend directory
|
| 646 |
-
cd frontend
|
| 647 |
-
|
| 648 |
-
# Copy environment template
|
| 649 |
-
cp .env.example .env
|
| 650 |
-
|
| 651 |
-
# Install Node.js dependencies
|
| 652 |
-
npm install
|
| 653 |
-
```
|
| 654 |
-
|
| 655 |
-
#### 4. Configure Environment Variables
|
| 656 |
-
|
| 657 |
-
##### Backend (.env in root directory):
|
| 658 |
-
```env
|
| 659 |
-
SECRET_KEY=your_secret_key_here
|
| 660 |
-
```
|
| 661 |
-
|
| 662 |
-
##### Frontend (frontend/.env):
|
| 663 |
-
```env
|
| 664 |
-
# Backend API Configuration
|
| 665 |
-
REACT_APP_API_BASE_URL=http://localhost:8000
|
| 666 |
-
|
| 667 |
-
# Development settings
|
| 668 |
-
NODE_ENV=development
|
| 669 |
-
|
| 670 |
-
# Firebase Configuration (optional)
|
| 671 |
-
# REACT_APP_FIREBASE_API_KEY=your_firebase_api_key
|
| 672 |
-
# REACT_APP_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
|
| 673 |
-
# REACT_APP_FIREBASE_PROJECT_ID=your_project_id
|
| 674 |
-
```
|
| 675 |
|
| 676 |
-
|
| 677 |
-
|
| 678 |
-
### Understanding the Multi-Database System
|
| 679 |
-
|
| 680 |
-
Tabble supports multiple independent hotel databases, allowing each hotel to operate with complete data isolation. Each database contains:
|
| 681 |
-
|
| 682 |
-
- **Dishes**: Menu items with pricing, categories, and images
|
| 683 |
-
- **Orders**: Customer orders and order items
|
| 684 |
-
- **Persons**: Customer information and visit history
|
| 685 |
-
- **Tables**: Table management and occupancy status
|
| 686 |
-
- **Loyalty Program**: Visit-based discount tiers
|
| 687 |
-
- **Selection Offers**: Amount-based promotional offers
|
| 688 |
-
- **Settings**: Hotel-specific configuration
|
| 689 |
-
- **Feedback**: Customer reviews and ratings
|
| 690 |
-
|
| 691 |
-
### Database Registry (hotels.csv)
|
| 692 |
-
|
| 693 |
-
The `hotels.csv` file serves as the central registry for all hotel databases:
|
| 694 |
-
|
| 695 |
-
```csv
|
| 696 |
-
hotel_database,password
|
| 697 |
-
tabble_new.db,myhotel
|
| 698 |
-
|
| 699 |
-
```
|
| 700 |
-
|
| 701 |
-
### Creating a New Hotel Database
|
| 702 |
-
|
| 703 |
-
#### Method 1: Using the create_empty_db.py Script
|
| 704 |
-
|
| 705 |
-
##### Windows:
|
| 706 |
-
```cmd
|
| 707 |
-
# Activate virtual environment
|
| 708 |
-
venv\Scripts\activate
|
| 709 |
-
|
| 710 |
-
# Run the database creation script
|
| 711 |
-
python create_empty_db.py
|
| 712 |
-
```
|
| 713 |
-
|
| 714 |
-
##### macOS/Linux:
|
| 715 |
-
```bash
|
| 716 |
-
# Activate virtual environment
|
| 717 |
-
source venv/bin/activate
|
| 718 |
-
|
| 719 |
-
# Run the database creation script
|
| 720 |
-
python create_empty_db.py
|
| 721 |
-
```
|
| 722 |
-
|
| 723 |
-
**Interactive Process:**
|
| 724 |
-
1. The script will prompt you for a database name
|
| 725 |
-
2. Enter the hotel name (without .db extension)
|
| 726 |
-
3. The script creates an empty database with proper schema
|
| 727 |
-
4. Manually add the database entry to `hotels.csv`
|
| 728 |
-
|
| 729 |
-
**Example:**
|
| 730 |
-
```
|
| 731 |
-
Creating a new empty database with the proper schema
|
| 732 |
-
Enter name for the new database (without .db extension): newhotel
|
| 733 |
-
|
| 734 |
-
Success! Created empty database 'newhotel.db' with the proper schema
|
| 735 |
-
```
|
| 736 |
-
|
| 737 |
-
Then add to `hotels.csv`:
|
| 738 |
-
```csv
|
| 739 |
-
newhotel.db,newhotel123
|
| 740 |
-
```
|
| 741 |
-
|
| 742 |
-
#### Method 2: Initialize with Sample Data
|
| 743 |
-
|
| 744 |
-
##### Windows:
|
| 745 |
-
```cmd
|
| 746 |
-
# Create database with sample data
|
| 747 |
-
python init_db.py
|
| 748 |
-
```
|
| 749 |
-
|
| 750 |
-
##### macOS/Linux:
|
| 751 |
-
```bash
|
| 752 |
-
# Create database with sample data
|
| 753 |
-
python init_db.py
|
| 754 |
```
|
| 755 |
|
| 756 |
-
|
| 757 |
-
|
| 758 |
-
### Database Schema Details
|
| 759 |
|
| 760 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 761 |
|
| 762 |
-
|
| 763 |
-
|
| 764 |
-
|
| 765 |
-
|
| 766 |
-
|
| 767 |
-
- **tables**: Table management and occupancy status
|
| 768 |
|
| 769 |
-
|
| 770 |
-
|
| 771 |
-
|
| 772 |
-
|
| 773 |
-
|
|
|
|
| 774 |
|
| 775 |
-
|
| 776 |
|
| 777 |
-
|
| 778 |
|
| 779 |
-
##### Windows:
|
| 780 |
-
```cmd
|
| 781 |
-
# Activate virtual environment
|
| 782 |
-
venv\Scripts\activate
|
| 783 |
-
|
| 784 |
-
# Start the FastAPI server
|
| 785 |
-
python run.py
|
| 786 |
```
|
| 787 |
-
|
| 788 |
-
|
| 789 |
-
|
| 790 |
-
# Activate virtual environment
|
| 791 |
-
source venv/bin/activate
|
| 792 |
-
|
| 793 |
-
# Start the FastAPI server
|
| 794 |
-
python run.py
|
| 795 |
```
|
| 796 |
|
| 797 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 798 |
|
| 799 |
-
|
| 800 |
-
|
| 801 |
-
##### Both Windows and macOS:
|
| 802 |
-
```bash
|
| 803 |
-
# Navigate to frontend directory
|
| 804 |
-
cd frontend
|
| 805 |
|
| 806 |
-
|
| 807 |
-
|
| 808 |
-
|
|
|
|
|
|
|
| 809 |
|
| 810 |
-
|
| 811 |
|
| 812 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 813 |
|
| 814 |
-
|
| 815 |
-
- **Swagger UI**: `http://localhost:8000/docs`
|
| 816 |
-
- **ReDoc**: `http://localhost:8000/redoc`
|
| 817 |
|
| 818 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 819 |
|
| 820 |
-
###
|
| 821 |
-
-
|
| 822 |
-
-
|
| 823 |
-
-
|
| 824 |
-
-
|
| 825 |
|
| 826 |
-
###
|
| 827 |
-
-
|
| 828 |
-
-
|
| 829 |
-
-
|
| 830 |
-
-
|
| 831 |
|
| 832 |
-
|
| 833 |
-
- **Custom Report Templates**: Configurable analytics reports
|
| 834 |
-
- **PDF Generation**: Automated report exports
|
| 835 |
-
- **Performance Metrics**: Comprehensive business intelligence
|
| 836 |
-
- **Multi-dimensional Analysis**: Customer, dish, and chef performance tracking
|
| 837 |
|
| 838 |
-
|
| 839 |
-
- **Firebase Phone OTP**: Secure customer authentication
|
| 840 |
-
- **Database Password Protection**: Hotel database access control
|
| 841 |
-
- **Session Management**: Secure session handling across interfaces
|
| 842 |
-
- **Data Isolation**: Complete separation of hotel data
|
| 843 |
|
| 844 |
-
|
|
|
|
|
|
|
|
|
|
| 845 |
|
| 846 |
-
|
| 847 |
|
| 848 |
-
|
| 849 |
-
|
| 850 |
-
|
| 851 |
-
|
| 852 |
|
| 853 |
-
|
| 854 |
-
python create_empty_db.py
|
| 855 |
|
| 856 |
-
|
| 857 |
-
# Edit run.py and change the port number
|
| 858 |
-
```
|
| 859 |
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
|
| 866 |
-
|
| 867 |
-
# Check that .env file exists in frontend directory
|
| 868 |
-
cp .env.example .env
|
| 869 |
|
| 870 |
-
|
| 871 |
-
# Verify REACT_APP_API_BASE_URL in frontend/.env
|
| 872 |
-
```
|
| 873 |
|
| 874 |
-
|
| 875 |
-
```bash
|
| 876 |
-
# If database schema is outdated
|
| 877 |
-
python init_db.py --force-reset
|
| 878 |
-
|
| 879 |
-
# If hotels.csv is missing entries
|
| 880 |
-
# Manually add your database to hotels.csv
|
| 881 |
-
```
|
| 882 |
-
|
| 883 |
-
### Platform-Specific Notes
|
| 884 |
-
|
| 885 |
-
#### Windows:
|
| 886 |
-
- Use `venv\Scripts\activate` to activate virtual environment
|
| 887 |
-
- Use `python` command (not `python3`)
|
| 888 |
-
- Ensure Python is added to PATH during installation
|
| 889 |
-
|
| 890 |
-
#### macOS:
|
| 891 |
-
- Use `source venv/bin/activate` to activate virtual environment
|
| 892 |
-
- Use `python3` command for Python 3.x
|
| 893 |
-
- Install Xcode Command Line Tools if needed: `xcode-select --install`
|
| 894 |
-
|
| 895 |
-
## π Development Workflow
|
| 896 |
-
|
| 897 |
-
### Adding a New Hotel Database
|
| 898 |
-
|
| 899 |
-
1. **Create Empty Database:**
|
| 900 |
-
```bash
|
| 901 |
-
python create_empty_db.py
|
| 902 |
-
```
|
| 903 |
-
|
| 904 |
-
2. **Add to Registry:**
|
| 905 |
-
Edit `hotels.csv` and add your database entry:
|
| 906 |
-
```csv
|
| 907 |
-
yourhotel.db,yourpassword123
|
| 908 |
-
```
|
| 909 |
-
|
| 910 |
-
3. **Configure Hotel Settings:**
|
| 911 |
-
- Access admin panel: `http://localhost:3000/admin`
|
| 912 |
-
- Navigate to Settings
|
| 913 |
-
- Configure hotel information
|
| 914 |
-
|
| 915 |
-
4. **Add Menu Items:**
|
| 916 |
-
- Use admin panel to add dishes
|
| 917 |
-
- Upload dish images to `app/static/images/dishes/yourhotel/`
|
| 918 |
-
|
| 919 |
-
### Deployment Considerations
|
| 920 |
-
|
| 921 |
-
#### Production Environment Variables:
|
| 922 |
-
```env
|
| 923 |
-
# Backend
|
| 924 |
-
SECRET_KEY=your_production_secret_key
|
| 925 |
-
DATABASE_URL=your_production_database_url
|
| 926 |
-
|
| 927 |
-
# Frontend
|
| 928 |
-
REACT_APP_API_BASE_URL=https://your-domain.com/api
|
| 929 |
-
NODE_ENV=production
|
| 930 |
-
```
|
| 931 |
|
| 932 |
-
|
| 933 |
-
-
|
| 934 |
-
-
|
| 935 |
-
-
|
| 936 |
|
|
|
|
| 937 |
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Tabble-v3 Restaurant Management
|
| 3 |
+
emoji: π½οΈ
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
pinned: false
|
| 9 |
+
license: mit
|
| 10 |
+
short_description: Modern restaurant management system with QR ordering and real-time analytics
|
| 11 |
+
tags:
|
| 12 |
+
- restaurant
|
| 13 |
+
- management
|
| 14 |
+
- fastapi
|
| 15 |
+
- qr-code
|
| 16 |
+
- ordering
|
| 17 |
+
- analytics
|
| 18 |
+
- multi-database
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# π½οΈ Tabble-v3 Restaurant Management System
|
| 22 |
+
|
| 23 |
+
A comprehensive restaurant management system built with FastAPI and modern web technologies, featuring QR code-based table ordering, real-time order management, and multi-database support for independent hotel operations.
|
| 24 |
+
|
| 25 |
+
## π Live Demo
|
| 26 |
+
|
| 27 |
+
This application is deployed on Hugging Face Spaces with Docker. Try all the features:
|
| 28 |
+
|
| 29 |
+
- **π Home Interface**: Complete system overview
|
| 30 |
+
- **π₯ Customer Ordering**: QR code-based table ordering system
|
| 31 |
+
- **π¨βπ³ Chef Dashboard**: Real-time kitchen order management
|
| 32 |
+
- **π¨ Admin Panel**: Complete restaurant control and analytics
|
| 33 |
+
|
| 34 |
+
## π Demo Credentials
|
| 35 |
+
|
| 36 |
+
- **Hotel Access Code**: `myhotel`
|
| 37 |
+
- **Demo Database**: `tabble_new.db`
|
| 38 |
+
- **Table Numbers**: 1-20
|
| 39 |
+
- **Phone OTP**: Any 6 digits (demo mode)
|
| 40 |
+
|
| 41 |
+
## β¨ Key Features
|
| 42 |
+
|
| 43 |
+
### π½οΈ Customer Experience
|
| 44 |
+
- **QR Code Ordering**: Scan table QR codes for instant menu access
|
| 45 |
+
- **Phone OTP Authentication**: Secure Firebase-based login
|
| 46 |
+
- **Real-time Cart**: Live cart updates with special offers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
- **Payment Integration**: Secure payment processing with loyalty discounts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
- **Order History**: Track past orders and preferences
|
| 49 |
|
| 50 |
+
### π¨βπ³ Kitchen Operations
|
| 51 |
+
- **Real-time Notifications**: Instant order alerts for chefs
|
| 52 |
+
- **Order Management**: Accept, prepare, and complete orders
|
| 53 |
+
- **Status Updates**: Live status changes across all interfaces
|
| 54 |
+
- **Kitchen Analytics**: Track preparation times and efficiency
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
+
### π¨ Restaurant Management
|
| 57 |
+
- **Multi-Database Support**: Independent hotel operations
|
| 58 |
+
- **Complete Admin Panel**: Full restaurant control
|
| 59 |
+
- **Menu Management**: Add, edit, and manage dishes with images
|
| 60 |
+
- **Analytics Dashboard**: Customer behavior and sales insights
|
| 61 |
+
- **Loyalty Programs**: Configurable visit-based discounts
|
| 62 |
+
- **Table Management**: Monitor occupancy and status
|
| 63 |
|
| 64 |
+
## π οΈ Technology Stack
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
- **Backend**: FastAPI 0.104.1 with Python 3.11
|
| 67 |
+
- **Database**: SQLite with SQLAlchemy ORM
|
| 68 |
+
- **Authentication**: Firebase Admin SDK
|
| 69 |
+
- **Templates**: Jinja2 with Bootstrap 5
|
| 70 |
+
- **Deployment**: Docker on Hugging Face Spaces
|
| 71 |
+
- **Architecture**: RESTful API with middleware patterns
|
| 72 |
|
| 73 |
+
## π§ Quick Start
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
+
### Using the Demo
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
1. **Access the Application**: Visit the Hugging Face Spaces URL
|
| 78 |
+
2. **Choose Interface**: Select Customer, Chef, or Admin from the home page
|
| 79 |
+
3. **Customer Login**: Use hotel code `myhotel` and any table number
|
| 80 |
+
4. **Explore Features**: Try ordering, kitchen management, or admin controls
|
| 81 |
|
| 82 |
+
### Local Development
|
|
|
|
|
|
|
| 83 |
|
|
|
|
| 84 |
```bash
|
| 85 |
+
# Clone the repository
|
| 86 |
+
git clone <repository-url>
|
| 87 |
+
cd tabble-v3
|
|
|
|
|
|
|
| 88 |
|
| 89 |
# Install dependencies
|
| 90 |
pip install -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
+
# Run locally
|
| 93 |
+
python run.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
```
|
| 95 |
|
| 96 |
+
## π± Interface Guide
|
|
|
|
|
|
|
| 97 |
|
| 98 |
+
### Customer Interface (`/customer`)
|
| 99 |
+
1. Select hotel and enter access code
|
| 100 |
+
2. Choose table number
|
| 101 |
+
3. Enter phone number for OTP verification
|
| 102 |
+
4. Browse menu and place orders
|
| 103 |
+
5. Track order status in real-time
|
| 104 |
|
| 105 |
+
### Chef Dashboard (`/chef`)
|
| 106 |
+
1. View live order notifications
|
| 107 |
+
2. Accept and manage incoming orders
|
| 108 |
+
3. Update order status (cooking, ready, completed)
|
| 109 |
+
4. Monitor kitchen performance metrics
|
|
|
|
| 110 |
|
| 111 |
+
### Admin Panel (`/admin`)
|
| 112 |
+
1. Complete restaurant management
|
| 113 |
+
2. Add and edit menu items
|
| 114 |
+
3. Configure pricing and offers
|
| 115 |
+
4. View analytics and reports
|
| 116 |
+
5. Manage hotel settings
|
| 117 |
|
| 118 |
+
## ποΈ Multi-Database Architecture
|
| 119 |
|
| 120 |
+
Each hotel operates with its own SQLite database:
|
| 121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
```
|
| 123 |
+
βββ tabble_new.db # Demo hotel database
|
| 124 |
+
βββ your_hotel.db # Your hotel database
|
| 125 |
+
βββ another_hotel.db # Additional hotel database
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
```
|
| 127 |
|
| 128 |
+
**Features:**
|
| 129 |
+
- Complete data isolation between hotels
|
| 130 |
+
- Independent menu and pricing
|
| 131 |
+
- Separate customer databases
|
| 132 |
+
- Individual analytics and reports
|
| 133 |
|
| 134 |
+
## π Security Features
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
+
- **Firebase Authentication**: Secure phone OTP verification
|
| 137 |
+
- **Database Protection**: Password-protected hotel access
|
| 138 |
+
- **Session Management**: Secure session handling
|
| 139 |
+
- **CORS Configuration**: Properly configured for web access
|
| 140 |
+
- **Data Isolation**: Complete separation between hotel data
|
| 141 |
|
| 142 |
+
## π Analytics & Reporting
|
| 143 |
|
| 144 |
+
- **Customer Analytics**: Behavior insights and visit patterns
|
| 145 |
+
- **Sales Reports**: Revenue tracking and trends
|
| 146 |
+
- **Dish Performance**: Menu item popularity metrics
|
| 147 |
+
- **Kitchen Efficiency**: Order processing analytics
|
| 148 |
+
- **Custom Reports**: PDF generation for business intelligence
|
| 149 |
|
| 150 |
+
## π― Use Cases
|
|
|
|
|
|
|
| 151 |
|
| 152 |
+
### Small Restaurants
|
| 153 |
+
- Single database operation
|
| 154 |
+
- QR code table ordering
|
| 155 |
+
- Basic order management
|
| 156 |
+
- Customer analytics
|
| 157 |
|
| 158 |
+
### Hotel Chains
|
| 159 |
+
- Multi-database architecture
|
| 160 |
+
- Independent hotel operations
|
| 161 |
+
- Centralized management
|
| 162 |
+
- Brand consistency
|
| 163 |
|
| 164 |
+
### Food Courts
|
| 165 |
+
- Multiple vendor support
|
| 166 |
+
- Shared customer interface
|
| 167 |
+
- Individual kitchen dashboards
|
| 168 |
+
- Unified payment processing
|
| 169 |
|
| 170 |
+
## π Deployment
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
|
| 172 |
+
This application is containerized with Docker and optimized for Hugging Face Spaces:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
+
- **Port**: 7860 (Hugging Face Spaces standard)
|
| 175 |
+
- **Build**: Automatic Docker build from repository
|
| 176 |
+
- **Environment**: Python 3.11-slim with all dependencies
|
| 177 |
+
- **Database**: Auto-initialized with demo data
|
| 178 |
|
| 179 |
+
## π API Documentation
|
| 180 |
|
| 181 |
+
Once deployed, explore the interactive API documentation:
|
| 182 |
+
- **Swagger UI**: `/docs`
|
| 183 |
+
- **ReDoc**: `/redoc`
|
| 184 |
+
- **Health Check**: `/health`
|
| 185 |
|
| 186 |
+
## π€ Contributing
|
|
|
|
| 187 |
|
| 188 |
+
This is an open-source project. Contributions are welcome!
|
|
|
|
|
|
|
| 189 |
|
| 190 |
+
1. Fork the repository
|
| 191 |
+
2. Create your feature branch
|
| 192 |
+
3. Commit your changes
|
| 193 |
+
4. Push to the branch
|
| 194 |
+
5. Create a Pull Request
|
| 195 |
|
| 196 |
+
## π License
|
|
|
|
|
|
|
| 197 |
|
| 198 |
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
|
|
|
|
|
| 199 |
|
| 200 |
+
## π Links
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
+
- **Documentation**: Comprehensive API docs available at `/docs`
|
| 203 |
+
- **GitHub**: Repository with full source code
|
| 204 |
+
- **Demo**: Live demo with sample data
|
| 205 |
+
- **Support**: Issues and discussions on GitHub
|
| 206 |
|
| 207 |
+
---
|
| 208 |
|
| 209 |
+
**Ready to transform your restaurant operations? Start exploring the demo now!** ππ½οΈ
|