An enterprise-grade, full-stack AI chatbot and appointment reservation platform combining Next.js 15, FastAPI, LangGraph, and Google Calendar.
Customers can seamlessly browse the café menu, order food with real-time cart tracking and automated receipts, or interact with a conversational AI agent to book table reservations, coffee tastings, barista workshops, and catering consultations with automatic Google Calendar invites and Google Meet video links.
- Natural Language Ordering: Order food items in plain English (e.g., "I'd like 2 Cheese Burgers and large fries").
- Automated Regex & Semantic Extraction: Detects item names, variants, and quantities on the fly.
- Live Interactive Cart: Instant subtotal calculation and real-time cart management.
- Instant Digital Receipts: Formatted itemized receipt generation with unique Order IDs.
- Full Café Menu API: Endpoints for browsing items across categories (Burgers, Fries, Drinks).
- Multi-Turn State Machine: Explicit conversational routing through LangGraph: $$\text{GREET} \longrightarrow \text{LIST_SERVICES} \longrightarrow \text{SELECT_SERVICE} \longrightarrow \text{COLLECT_DETAILS} \longrightarrow \text{CONFIRM} \longrightarrow \text{BOOKED}$$
-
Smart Parameter Validation: Enforces valid future dates (
YYYY-MM-DD), 24-hour time slots (HH:MM), and email validation before transitioning to confirmation. - Session Memory & Expiry: Persistent state per browser session in SQLite/PostgreSQL with automatic 24-hour expiration resets.
- Conflict Prevention: Real-time slot availability check preventing double-bookings.
-
Seeded Service Catalog: Pre-configured services including:
- Table Reservation (60 min)
- Coffee & Burger Tasting Experience (45 min)
- Barista Masterclass & Brewing (60 min)
- Event & Catering Consultation (30 min)
- Auto Event Creation: Directly creates scheduled events on the business Google Calendar.
- Google Meet Links: Generates one-click video meeting links for virtual consultations and confirmations.
- Calendar Sync & Cancellation: Deleting or cancelling a booking removes the calendar event automatically.
- OAuth2 Authentication Flow: Built-in helper routes (
/auth/google&/auth/google/callback) to easily obtain refresh tokens.
- Tabbed Experience: Easily toggle between 🍔 Food & Drinks and 📅 Table & Appointments.
- Interactive Service Badges: Click any service card to initiate an automated booking flow.
- Booking Confirmation Cards: Visual confirmation display with Booking ID and Google Meet join button.
- "My Bookings" Drawer: Look up and cancel past reservations by customer email.
AI_Cafe_Bot/
├── backend/
│ ├── src/
│ │ └── app/
│ │ ├── main.py # FastAPI entrypoint, lifespan, CORS, GZip
│ │ ├── config/
│ │ │ ├── settings.py # Pydantic Settings (.env configuration)
│ │ │ ├── database.py # Async SQLAlchemy engine & session factory
│ │ │ └── llm_client.py # Multi-provider LLM client (Groq / Gemini)
│ │ ├── models/
│ │ │ ├── service.py # Service ORM Model
│ │ │ ├── booking.py # Booking ORM Model
│ │ │ └── session.py # ChatSession ORM Model
│ │ ├── routes/
│ │ │ ├── chat.py # POST /api/chat (LangGraph flow)
│ │ │ ├── services_bookings.py # CRUD for Services and Bookings
│ │ │ ├── cafe.py # Cafe menu, cart, ordering & receipts
│ │ │ └── schemas.py # Pydantic schemas with validators
│ │ ├── services/
│ │ │ ├── ai/
│ │ │ │ ├── booking_graph.py # Compiled LangGraph StateGraph
│ │ │ │ ├── graph_state.py # TypedDict GraphState
│ │ │ │ ├── nodes.py # LLM invoke, validation & finalization
│ │ │ │ ├── orchestrator.py # Session manager & LangGraph runner
│ │ │ │ └── prompts.py # State-specific prompt templates
│ │ │ ├── booking/
│ │ │ │ └── booking_service.py # Booking logic & conflict checker
│ │ │ ├── services/
│ │ │ │ └── catalog_service.py # Service catalog & auto-seeding
│ │ │ └── calendar/
│ │ │ └── google_calendar.py # Google Calendar & Meet API client
│ │ ├── middleware/
│ │ │ └── logging_middleware.py # Request logging with ms timing
│ │ └── utils/
│ │ └── date_utils.py # Date & time parsing utilities
│ ├── .env.example
│ └── requirements.txt
├── frontend/
│ ├── pages/
│ │ ├── index.js # Dual-mode Interactive Chat & Ordering UI
│ │ ├── _app.js
│ │ └── _document.js
│ ├── styles/
│ └── package.json
├── tests/
│ └── test_backend.py # Unit and integration tests
├── Backendd/ # Backwards-compatible legacy entrypoint
│ └── main.py
└── README.md
- Python 3.10+ (Python 3.11, 3.12, or 3.13 recommended)
- Node.js 18+ & npm
-
Navigate to the backend directory:
cd backend -
Create and activate a virtual environment:
# Windows python -m venv venv venv\Scripts\activate # macOS / Linux python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure Environment Variables: Create a
.envfile inbackend/or project root (copy frombackend/.env.example):# LLM API Keys GROQ_API_KEY=your_groq_api_key GEMINI_API_KEY=your_gemini_api_key LLM_MODEL=llama-3.3-70b-versatile # App Configuration COMPANY_NAME=Fireball Cafe & Bistro APP_NAME=Fireball Cafe & Reservations PORT=8000 ENVIRONMENT=development FRONTEND_URL=http://localhost:3000 # Database (Async SQLite by default) DATABASE_URL=sqlite+aiosqlite:///./appointments.db SYNC_DATABASE_URL=sqlite:///./appointments.db # Google Calendar (Optional) GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret GOOGLE_REFRESH_TOKEN=your_google_refresh_token GOOGLE_REDIRECT_URI=http://localhost:8000/auth/google/callback GOOGLE_CALENDAR_ID=primary
-
Start the Backend Server:
uvicorn app.main:app --reload --port 8000 # or from project root: python Backendd/main.py- The API documentation will be accessible at:
http://localhost:8000/docs - Health status check:
http://localhost:8000/api/health
- The API documentation will be accessible at:
-
Navigate to the frontend directory:
cd frontend -
Install Node dependencies:
npm install
-
Configure Environment Variables: Create
.env.localinfrontend/:NEXT_PUBLIC_API_URL=http://localhost:8000
-
Start the Next.js development server:
npm run dev
- Open http://localhost:3000 in your browser.
This repository is pre-configured for zero-config deployment on Vercel supporting both the Next.js Frontend and the Python FastAPI Serverless Backend:
- Push your changes to GitHub.
- Go to vercel.com/new and import your
AI_Cafe_Botrepository. - Keep the Root Directory as
./(the repository root containsvercel.json). - Under Environment Variables, add:
GROQ_API_KEY(orGEMINI_API_KEY)COMPANY_NAME=Fireball Cafe & BistroLLM_MODEL=llama-3.3-70b-versatile- (Optional)
GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET,GOOGLE_REFRESH_TOKEN
- Click Deploy. Vercel will automatically build the Next.js frontend and deploy the Python Serverless APIs.
# Install Vercel CLI
npm install -g vercel
# Deploy to preview
vercel
# Deploy to production
vercel --prodTo enable automatic Google Calendar event creation and Google Meet link generation:
- Go to the Google Cloud Console and create a project.
- Enable the Google Calendar API under APIs & Services > Library.
- Configure OAuth Consent Screen (add your email as a Test User).
- Create OAuth 2.0 Client ID (Web application), adding Authorized Redirect URI:
http://localhost:8000/auth/google/callback - Place
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETin your.env. - Start the backend and visit:
http://localhost:8000/auth/googlein your browser. - Grant permissions and copy the returned
refresh_tokeninto your.envasGOOGLE_REFRESH_TOKEN.
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/health |
Backend and LLM health check |
POST |
/api/chat |
AI Appointment Booking chat endpoint (LangGraph) |
GET |
/api/services |
List all active booking services |
POST |
/api/services |
Create a new service (Admin) |
POST |
/api/bookings |
Directly create an appointment booking |
GET |
/api/bookings/{id} |
Get booking details by ID |
GET |
/api/bookings?email= |
List all bookings for a given customer email |
DELETE |
/api/bookings/{id} |
Cancel booking and remove Calendar event |
GET |
/api/menu |
Retrieve café food and drink menu |
POST |
/api/register |
Register customer credentials and session |
POST |
/api/cafe/chat |
AI Café food ordering chat endpoint |
GET |
/api/cart/{session_id} |
Retrieve customer shopping cart |
POST |
/api/clear-cart/{session_id} |
Clear cart items |
GET |
/auth/google |
Initiate Google OAuth2 authorization |
GET |
/auth/google/callback |
OAuth2 callback to receive refresh token |
Run the automated test suite verifying date utilities, models, LangGraph validation nodes, and state transitions:
# Using pytest
pytest tests/test_backend.py -v
# Or run directly via Python
python tests/test_backend.py