PFE Master · Hotel AI Chatbot

Conversational assistant for
Holiday Beach Djerba ★★★★

A full-stack AI chatbot embedded in the hotel's web interface. Handles reservations, services, and guest inquiries using Google Gemini Flash — with a smart fallback system when the AI is unavailable.

Google Gemini Flash React + Vite Flask REST API MySQL Python Flask-CORS Axios dotenv
System architecture — full-stack · 3 layers
Frontend — React + Vite Chatbot.jsx Widget flottant · état messages Quick replies Réserver · Horaires · Contact Axios HTTP client POST /api/chat · user_id Fallback UI si erreur API HTTP Backend — Flask · Python app.py — REST API POST /api/chat · GET /api/health brain.py — Brain class process() → AI or fallback _ai_response() · _smart_response() Config hôtel · tel · email database.py MySQL connector · réservations API Google Gemini Flash generate_content() Prompt hôtel · 1-2 phrases GOOGLE_API_KEY · .env MySQL Database hotel_reservations · projet_mobile_db Response content · quick_replies type: ai | smart
Layer 01 — Frontend
React + Vite chatbot widget
Floating chat button that expands into a full conversation UI. Manages message state, scroll behavior, and quick reply buttons. Communicates with the Flask API via Axios POST requests.
React 18 · Vite · Axios
Layer 02 — Backend
Flask REST API + Brain class
Flask exposes two endpoints: POST /api/chat for conversation and GET /api/health for status. The Brain class decides whether to call Gemini AI or use the smart keyword-based fallback, and reads hotel reservation counts from MySQL.
Flask · Flask-CORS · Python
Layer 03 — AI
Google Gemini Flash
Hotel-specific prompt feeds each user message to Gemini with the hotel's identity context. Responds in 1–2 natural sentences. API key loaded from .env. If Gemini fails, the smart fallback handles common intents (booking, hours, contact) without any downtime.
Gemini Flash · dotenv
Layer 04 — Database
MySQL — hotel_reservations
MySQL database stores hotel reservations. The Brain class queries reservation counts to enrich booking responses. Connection managed securely via environment variables.
MySQL connector · Python
Layer 05 — Resilience
Smart fallback system
If Gemini is unavailable or the API key is missing, the chatbot switches to a keyword-matching fallback — detecting greetings, booking intent, and contact requests — ensuring zero downtime for hotel guests.
Fallback · keyword matching
Delivery
Full-stack production-ready
React frontend served via Vite, Flask backend running on port 5000 with CORS enabled for web embedding. Easily deployable on any hotel website as an embeddable widget.
delivered
Live demo · Hotel Chatbot

Holiday Beach Djerba
AI assistant — interactive

Try the chatbot below. Select a preset or type your own message. Powered by the same Brain class logic as the production system.

🏨 Holiday Beach
★★★★ Djerba · AI Assistant
● online
🏨 Bienvenue à Holiday Beach Djerba ! Comment puis-je vous aider ?
⚙️ System status
AI engineGemini Flash
BackendFlask · port 5000
DatabaseMySQL · reservations
FallbackSmart keywords
Messages1 sent
🏨 Hotel info
HotelHoliday Beach Djerba
Category★★★★ 4 stars
Phone+216 75 758 063
Emailbooking@holidaybeach.com.tn
💬 Try these messages