Shyamnath commited on
Commit
3014fc3
Β·
1 Parent(s): 960b03d

Fix README.md Hugging Face Spaces metadata configuration

Browse files
Files changed (1) hide show
  1. README.md +160 -888
README.md CHANGED
@@ -1,937 +1,209 @@
1
- # Tabble-v3
2
-
3
- A modern restaurant management system built with Python FastAPI and React.
4
- 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.
5
-
6
- ## πŸš€ Quick Deploy on Hugging Face Spaces
7
-
8
- [![Deploy on Hugging Face Spaces](https://huggingface.co/datasets/huggingface/badges/raw/main/deploy-on-spaces-md.svg)](https://huggingface.co/new-space?template=your-username/tabble-v3)
9
-
10
- Tabble-v3 is now optimized for **Hugging Face Spaces** deployment! Deploy your restaurant management system with just a few clicks.
11
-
12
- ### 🌐 Live Demo
13
- - **Demo URL**: [Your Space URL after deployment]
14
- - **Admin Panel**: `/admin` (use access code: `myhotel`)
15
- - **Chef Dashboard**: `/chef`
16
- - **Customer Interface**: `/customer`
17
- - **API Documentation**: `/docs`
18
-
19
- ### πŸ“¦ One-Click Deployment
20
-
21
- 1. **Fork this repository** to your GitHub account
22
- 2. **Go to [Hugging Face Spaces](https://huggingface.co/new-space)**
23
- 3. **Select "Docker" as the SDK**
24
- 4. **Connect your GitHub repository**
25
- 5. **Wait for automatic build and deployment**
26
- 6. **Access your live restaurant management system!**
27
-
28
- That's it! Your restaurant management system will be live and accessible to the world.
29
-
30
- ### πŸ”§ Environment Configuration
31
-
32
- The application comes pre-configured for Hugging Face Spaces with:
33
- - **Port**: 7860 (Hugging Face Spaces default)
34
- - **Demo Database**: Pre-loaded with sample data
35
- - **Sample Hotel**: "Demo Hotel" with access code `myhotel`
36
- - **Templates**: Complete web interface included
37
-
38
- ### 🏨 Multi-Hotel Setup
39
-
40
- To add your own hotel:
41
-
42
- 1. **Edit `hotels.csv`**:
43
- ```csv
44
- hotel_database,password
45
- tabble_new.db,myhotel
46
- your_hotel.db,your_password
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
- ### πŸ‘¨β€πŸ³ Chef Dashboard
514
- - **Real-time Order Management**: Live order notifications and updates
515
- - **Kitchen Operations**: Streamlined order acceptance and completion
516
- - **Order Status Updates**: Instant status changes reflected across all interfaces
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
- #### For Windows:
598
- - **Python 3.8+**: Download from [python.org](https://www.python.org/downloads/)
599
- - **Node.js 16+**: Download from [nodejs.org](https://nodejs.org/downloads/)
600
- - **Git**: Download from [git-scm.com](https://git-scm.com/downloads)
 
 
 
601
 
602
- #### For macOS:
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
- ### πŸ”§ Installation & Setup
 
 
 
 
 
608
 
609
- #### 1. Clone the Repository
610
- ```bash
611
- git clone <repository-url>
612
- cd tabble
613
- ```
614
-
615
- #### 2. Backend Setup
616
 
617
- ##### Windows:
618
- ```cmd
619
- # Create virtual environment
620
- python -m venv venv
621
 
622
- # Activate virtual environment
623
- venv\Scripts\activate
 
 
624
 
625
- # Install dependencies
626
- pip install -r requirements.txt
627
- ```
628
 
629
- ##### macOS/Linux:
630
  ```bash
631
- # Create virtual environment
632
- python3 -m venv venv
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
- ## πŸ—„οΈ Database Management
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
- **Note:** This creates `tabble_new.db` with sample dishes, users, and configuration.
757
-
758
- ### Database Schema Details
759
 
760
- The `create_empty_db.py` script creates the following tables:
 
 
 
 
 
761
 
762
- #### Core Tables:
763
- - **dishes**: Menu items with pricing, categories, offers, and visibility
764
- - **persons**: Customer profiles with visit tracking
765
- - **orders**: Order management with status tracking
766
- - **order_items**: Individual items within orders
767
- - **tables**: Table management and occupancy status
768
 
769
- #### Configuration Tables:
770
- - **loyalty_program**: Visit-based discount configuration
771
- - **selection_offers**: Amount-based promotional offers
772
- - **settings**: Hotel information and branding
773
- - **feedback**: Customer reviews and ratings
 
774
 
775
- ### Running the Application
776
 
777
- #### Start Backend Server
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
- ##### macOS/Linux:
789
- ```bash
790
- # Activate virtual environment
791
- source venv/bin/activate
792
-
793
- # Start the FastAPI server
794
- python run.py
795
  ```
796
 
797
- The backend will be available at `http://localhost:8000`
 
 
 
 
798
 
799
- #### Start Frontend Development Server
800
-
801
- ##### Both Windows and macOS:
802
- ```bash
803
- # Navigate to frontend directory
804
- cd frontend
805
 
806
- # Start React development server
807
- npm start
808
- ```
 
 
809
 
810
- The frontend will be available at `http://localhost:3000`
811
 
812
- ### πŸ”— API Documentation
 
 
 
 
813
 
814
- Once the backend is running, access the interactive API documentation:
815
- - **Swagger UI**: `http://localhost:8000/docs`
816
- - **ReDoc**: `http://localhost:8000/redoc`
817
 
818
- ## 🎯 Key Features Implementation
 
 
 
 
819
 
820
- ### 🍽️ Table Management
821
- - **QR Code Generation**: Automatic QR code creation for each table
822
- - **Real-time Status Monitoring**: Live table occupancy tracking
823
- - **Session-based Occupancy**: Table status changes based on customer interaction
824
- - **Multi-database Support**: Table management per hotel database
825
 
826
- ### πŸ“± Order Processing
827
- - **Real-time Order Tracking**: Live order status updates across all interfaces
828
- - **Kitchen Notifications**: Instant order notifications to chef dashboard
829
- - **Status Synchronization**: Order status changes reflect immediately
830
- - **Payment Integration**: Secure payment processing with loyalty discounts
831
 
832
- ### πŸ“Š Analytics and Reporting
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
- ### πŸ” Authentication & Security
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
- ## 🚨 Troubleshooting
 
 
 
845
 
846
- ### Common Issues
847
 
848
- #### Backend Issues:
849
- ```bash
850
- # If you get "Module not found" errors
851
- pip install -r requirements.txt
852
 
853
- # If database connection fails
854
- python create_empty_db.py
855
 
856
- # If port 8000 is already in use
857
- # Edit run.py and change the port number
858
- ```
859
 
860
- #### Frontend Issues:
861
- ```bash
862
- # If npm install fails
863
- npm cache clean --force
864
- npm install
865
 
866
- # If environment variables aren't loading
867
- # Check that .env file exists in frontend directory
868
- cp .env.example .env
869
 
870
- # If API calls fail
871
- # Verify REACT_APP_API_BASE_URL in frontend/.env
872
- ```
873
 
874
- #### Database Issues:
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
- #### Image Storage:
933
- - Images are stored in `app/static/images/dishes/{database_name}/`
934
- - Ensure proper directory permissions for image uploads
935
- - Consider using cloud storage for production deployments
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!** πŸš€πŸ½οΈ