Skip to content

About

Restaurant order management platform developed in partnership with Colégio Poliedro, featuring a customer chatbot, management dashboard and backend services.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

PI Chatbot Poliedro - Complete Restaurant Management System

Overview

PI Chatbot Poliedro is a comprehensive restaurant management and ordering platform designed for Colégio Poliedro. The system combines a conversational WhatsApp chatbot interface with a mobile app for customers and a seller dashboard for restaurant staff. This integrated solution streamlines the entire restaurant workflow—from customer ordering to inventory management—reducing wait times, improving order accuracy, and enhancing the dining experience through intelligent conversation and real-time data synchronization.

Project Context

This project was developed as part of the Interdisciplinary Integrating Project (PII) for the 3rd semester by Computer Science students at Instituto Mauá de Tecnologia (IMT), in partnership with Poliedro Sistema de Ensino. The platform demonstrates a full-stack approach to solving real-world restaurant operations challenges through modern mobile development, backend services, and cloud infrastructure.

Business Problem

Traditional restaurant ordering processes rely on customers visiting a physical counter, browsing menus, and manually placing orders. This approach creates bottlenecks during peak hours, leads to order inaccuracies, and provides limited accessibility. Staff managing inventory and menu items face challenges with real-time data synchronization across multiple touchpoints. The need exists for a modern, accessible ordering system that:

  • Enables customers to place orders remotely through familiar interfaces (WhatsApp, mobile apps)
  • Reduces order processing time and human error
  • Provides real-time inventory and menu management
  • Streamlines the workflow between customers, staff, and kitchen operations
  • Improves order tracking and customer experience

Solution Overview

PI Chatbot Poliedro provides three integrated interfaces:

  1. WhatsApp Chatbot: Customers interact with a conversational bot through WhatsApp, guiding them through a structured menu selection process (dishes → beverages → special requests → confirmation)

  2. Mobile App for Customers: A Flutter-based mobile application offering a visual interface for browsing menus, placing orders, tracking order status, and maintaining message history with the chatbot

  3. Seller Dashboard: A Flutter application enabling restaurant staff to manage menu items in real-time, view sales data, and maintain inventory through a clean, intuitive interface

All components connect to a shared Supabase database, ensuring data consistency and enabling real-time synchronization across the entire system.

System Architecture

The platform follows a modular, layered architecture that separates concerns and enables scalability:

Customer Interactions
↓
┌─────────────────────────────────────────┐
│  WhatsApp Interface (Twilio)            │
│  Mobile App (Flutter)                   │
└─────────────────┬───────────────────────┘
                  ↓
        ┌─────────────────────┐
        │  Backend API Layer  │
        │  (Flask + Python)   │
        │  (REST Endpoints)   │
        └────────┬────────────┘
                 ↓
        ┌─────────────────────┐
        │  Supabase           │
        │  (PostgreSQL)       │
        │  (Real-time Sync)   │
        └────────┬────────────┘
                 ↓
        ┌─────────────────────┐
        │  Data Tables        │
        │  - Menu (Dishes)    │
        │  - Menu (Beverages) │
        │  - Orders           │
        │  - Messages         │
        └─────────────────────┘
                 ↓
        ┌─────────────────────┐
        │  Seller Dashboard   │
        │  (Flutter App)      │
        │  - Menu Management  │
        │  - Sales Area       │
        └─────────────────────┘

Flow: Customers initiate orders through WhatsApp or the mobile app → Backend processes messages and manages state → Data syncs to Supabase → Seller dashboard reflects real-time updates → Orders flow to kitchen operations

Technologies

Frontend

  • Mobile Framework: Flutter 3.0+ with Dart programming language
  • Low-Code Platform: FlutterFlow for rapid UI development
  • State Management: Provider pattern for reactive state updates
  • Navigation: GoRouter for declarative routing and deep linking
  • Authentication: Supabase Auth with email validation
  • UI Components: Material Design, Google Fonts, Font Awesome icons
  • Animations: Flutter Animate, Rive animations
  • Platform Support: iOS, Android, and Web

Backend

  • Framework: Flask 3.1.0 (Python 3.x)
  • Architecture: State-machine-based conversational system
  • Production Server: Gunicorn 23.0.0 for WSGI deployment
  • Deployment: Heroku with Procfile configuration

Database

  • Platform: Supabase (Backend-as-a-Service)
  • Database Engine: PostgreSQL
  • Real-time Sync: Supabase Realtime 2.4.2
  • Local Storage: SQLite, Shared Preferences, Hive
  • Caching: Cached Network Image for performance optimization

APIs and Integrations

  • WhatsApp Integration: Twilio 9.5.2 webhook for message handling
  • Chat Messaging: Supabase Messages table for persistent chat history
  • Authentication: GoTrue 2.12.0 (Supabase authentication client)
  • Cloud Storage: Storage3 0.11.3 for file management
  • Deep Linking: Support for App Links and URL schemes

Infrastructure

  • Authentication Client: Supabase GoTrue 2.12.0
  • Testing: Pytest 8.3.5 and Pytest-mock 3.14.0
  • Version Control: Git
  • Package Management: pip (Python), pubspec.yaml (Flutter)

Main Features

Cross-Platform Ordering

  • WhatsApp Integration: Native ordering through WhatsApp via Twilio webhook
  • Mobile App: Visual interface with real-time menu browsing and order placement
  • Conversational Flow: Guided state-machine dialogue for seamless ordering process
  • Order Customization: Support for special requests and observation notes

Menu Management

  • Dynamic Menu Loading: Real-time menu updates from database
  • Dish Management: Create, read, update, delete operations for main courses
  • Beverage Management: Separate management for drink selections
  • Price Calculation: Real-time total calculation with currency formatting (Brazilian Real - R$)

Order Management & Tracking

  • Order Persistence: All orders permanently stored in Supabase
  • Unique Order IDs: Automatic order identification and confirmation
  • Order History: Message persistence in chat interface with timestamp tracking
  • Order Validation: Prevents duplicate concurrent orders (maximum 2 active per user)

User Experience

  • Session Management: User-specific state tracking with 5-minute inactivity timeout
  • Dark Mode Support: Light and dark theme switching
  • Responsive Design: Auto-scaling text and adaptive layouts
  • Local Caching: Offline support with local data persistence
  • Real-time Synchronization: Supabase-powered updates across all clients

Seller Operations

  • Sales Dashboard: Real-time sales area with metrics visualization
  • Inventory Management: Quick menu item visibility and availability tracking
  • CRUD Operations: Manage menu items with pop-up dialogs for add, edit, delete operations
  • Data Safety: Confirmation dialogs prevent accidental item deletion

System Components

Frontend Chatbot

Purpose & Responsibilities: The Frontend Chatbot is a cross-platform mobile application that serves as the customer-facing interface for the restaurant ordering system. It enables customers to browse menus, place orders, and maintain conversation history with the chatbot through an intuitive mobile experience.

Key Responsibilities:

  • Deliver real-time messaging interface with bot responses
  • Display menu items (dishes and beverages) with details and pricing
  • Manage order placement and tracking workflow
  • Synchronize data with Supabase for chat history and menu updates
  • Provide authentication and profile management
  • Support multiple platforms (iOS, Android, Web) from a single codebase
  • Implement local caching and offline capabilities

Technology Stack: Flutter, Dart, FlutterFlow, Supabase, PostgreSQL, Provider, GoRouter

Repository: github.com/PI-2025-ChatBot/frontend-chatbot

Backend Chatbot

Purpose & Responsibilities: The Backend Chatbot is a conversational ordering engine that processes messages from customers (via WhatsApp through Twilio) and manages the complete ordering workflow. It implements a state machine to guide customers through menu selection, order confirmation, and payment.

Key Responsibilities:

  • Handle incoming WhatsApp messages via Twilio webhook
  • Implement state-machine logic for conversational flow (inicio → menu → escolhendo_prato → confirmar_prato → pergunta_bebida → escolhendo_bebida → confirmar_bebida → observacao → confirmacao)
  • Manage user sessions with automatic timeout after 5 minutes of inactivity
  • Fetch menu items dynamically from Supabase database
  • Persist orders to database with automatic ID generation
  • Calculate order totals and format prices
  • Prevent duplicate concurrent orders per user
  • Return TwiML-formatted responses for WhatsApp delivery

Technology Stack: Python, Flask, Twilio, Supabase, Gunicorn, PostgreSQL

Repository: github.com/PI-2025-ChatBot/backend-chatbot

Seller Area

Purpose & Responsibilities: The Seller Area is a dedicated Flutter application providing restaurant staff with tools to manage menus and view sales data. It enables vendors to maintain up-to-date menu offerings and monitor point-of-sale operations through a clean, branded interface.

Key Responsibilities:

  • Display sales metrics and operational data in real-time
  • Provide menu management interface with tabbed navigation for dishes and beverages
  • Implement CRUD operations (Create, Read, Update, Delete) for menu items
  • Synchronize all changes with Supabase for immediate visibility across customer interfaces
  • Present confirmation dialogs for destructive operations
  • Manage responsive UI with Material Design and Colégio Poliedro branding
  • Support multi-platform deployment (iOS, Android, Web)
  • Cache frequently accessed data for performance

Technology Stack: Flutter, Dart, FlutterFlow, Supabase, Provider, GoRouter, PostgreSQL

Repository: github.com/PI-2025-ChatBot/sellerarea

Customer Interface

The mobile app provides an intuitive chat interface where customers can browse menus, place orders, and maintain conversation history. The interface supports both light and dark modes.

Seller Dashboard

The seller area features a tabbed interface organizing dishes and beverages separately, with action buttons for add, edit, and delete operations. The sales area displays real-time operational metrics.

Database Structure

The system uses a PostgreSQL database (via Supabase) with the following key tables:

  • Mensagens (Messages): Chat conversation history with sender email, timestamp, and bot indicator
  • Pedidos (Orders): Order records including dish selection, beverage choice, total price, notes, and status
  • Cardapio_Pratos (Menu - Dishes): Main course items with ID, name, description, and price
  • Cardapio_Bebidas (Menu - Beverages): Beverage items with ID, name, description, and price

System Flow

Customer WhatsApp Message
        ↓
   Twilio Receives Message
        ↓
   Flask Backend Route Handler
        ↓
   State Machine Logic Processes Context
        ↓
   Database Lookup (Menu Items, Current Order)
        ↓
   Generate Bot Response
        ↓
   Send TwiML Response via Whatsapp
        ↓
Customer Receives Message & Responds

My Contributions

Based on repository analysis, the development demonstrates:

  • Backend Architecture: Designed and implemented Flask REST API with state-machine conversational engine
  • API Integration: Integrated Twilio for WhatsApp messaging and Supabase for database operations
  • State Management: Implemented session management with timeout logic and concurrent order prevention
  • Frontend Architecture: Created modular Flutter structure separating backend integration, UI, and models
  • Database Design: Structured PostgreSQL schema with menu tables and order persistence
  • Mobile Development: Built cross-platform Flutter applications supporting iOS, Android, and web
  • Real-time Synchronization: Implemented Supabase integration for real-time data updates across clients
  • Authentication: Set up domain-specific email validation (@p4ed.com) with Supabase Auth
  • UI/UX Implementation: Developed FlutterFlow-based components with responsive design and theming
  • CRUD Operations: Implemented menu management workflows with confirmation dialogs and error handling
  • Performance Optimization: Applied image caching, lazy loading, and local data persistence strategies

Technical Challenges

  1. State Management Across Platforms: Maintaining consistent application state across WhatsApp (stateless webhook), Flutter mobile (local state), and real-time database synchronization required careful session design and timeout mechanisms.

  2. Conversational Flow Complexity: Implementing a robust state machine that handles all possible user inputs and edge cases (invalid selections, timeouts, concurrent orders) while maintaining a natural conversational experience.

  3. Real-time Data Synchronization: Ensuring menu updates from the seller dashboard immediately reflect in customer interfaces while managing database consistency and minimizing bandwidth usage.

  4. Multi-Platform Flutter Development: Building a single Flutter codebase that works seamlessly across iOS, Android, and web platforms while maintaining platform-specific optimizations and native features.

  5. Session Management: Implementing reliable session tracking with automatic timeout after inactivity while preventing duplicate orders and managing concurrent user interactions through a stateless webhook architecture.

Repository Map

Repository Purpose Technology
frontend-chatbot Customer-facing mobile app for browsing menus and placing orders Flutter, Dart, Supabase, GoRouter
backend-chatbot WhatsApp conversational ordering engine and state machine Python, Flask, Twilio, Supabase
sellerarea Vendor dashboard for menu management and sales operations Flutter, Dart, Supabase, GoRouter

Team

Developed by Computer Science students at Instituto Mauá de Tecnologia (IMT) as part of the Interdisciplinary Integrating Project (PII) - 3rd Semester, in partnership with Poliedro Sistema de Ensino.

Future Improvements

Customer Experience:

  • Enhanced AI Capabilities: Implement advanced NLP for context-aware responses and personalized recommendations
  • Payment Integration: Add in-app payment processing with multiple payment methods
  • Push Notifications: Real-time order status updates and promotional notifications
  • Multi-Language Support: Expand beyond Portuguese to support international customers
  • Voice Commands: Enable hands-free ordering through speech recognition
  • Order History Analytics: Implement recommendation engine based on user preferences
  • Real-Time Collaboration: Support group ordering features for multiple customers

Platform & Operations:

  • Image Recognition: Photo-based menu item identification for faster ordering
  • Inventory Tracking: Advanced stock management with low-stock alerts and reordering automation
  • User Roles: Implement role-based access control for different staff levels
  • Bulk Operations: Add bulk import/export functionality for menu management
  • Search Functionality: Implement full-text search and filtering for large menus
  • Offline Mode: Enhanced offline capability with better local data synchronization

Performance & Infrastructure:

  • Multi-Instance Deployment: Move session storage to Redis for distributed system support
  • Performance Optimization: Implement pagination, lazy loading, and reduce bundle size
  • Logging & Monitoring: Comprehensive logging system for production debugging and analytics
  • Rate Limiting: Add abuse prevention and request throttling
  • Database Connection Pooling: Improve performance under high load

Administrative Features:

  • Order History Endpoint: Allow customers to track previous orders
  • Administrative Endpoints: Menu management without direct database access
  • Multi-Location Support: Enable management of multiple restaurant locations
  • Order Cancellation: Implement time-window based order cancellation
  • Accessibility: Enhanced accessibility features for users with different abilities

Academic Context

Institution: Instituto Mauá de Tecnologia (IMT)
Course: Computer Science
Project: Interdisciplinary Integrating Project (PII)
Semester: 3rd
Partner Organization: Poliedro Sistema de Ensino
Year: 2025


Project Repositories:

About

Restaurant order management platform developed in partnership with Colégio Poliedro, featuring a customer chatbot, management dashboard and backend services.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors