An AI-assisted operations dashboard for venue and event businesses. ProfitPilot turns booking-request emails into structured event details, helps draft customer replies and invoices, and pairs the workflow with revenue analysis and demand forecasting.
HackIllinois HackOlympian Track Finalist · View the Devpost project
ProfitPilot is a hackathon prototype for reducing the manual work behind venue bookings. It brings a booking inbox, scheduling workflow, invoice handling, and financial reporting into a single React dashboard.
Its primary workflows are:
- Booking intake: paste or select a booking-request email, extract the client, date, times, attendee count, purpose, and special requests with Gemini.
- Availability and response drafting: compare a request with scheduled events, offer alternate slots when there is a conflict, and generate confirmation or rejection emails.
- Invoice generation: turn accepted booking details into an AI-generated invoice and review stored invoices in the UI.
- Financial digest: display recent weekly revenue, an AI-written revenue summary, and a Prophet demand forecast built from purchase data.
- Operations dashboard: provide demo views for event scheduling, financial records, email monitoring, activity history, and natural-language data queries.
┌─────────────────────────────────────────────────────────────────┐
│ React 19 + Vite client (frontend/, http://localhost:5173) │
│ │
│ Weekly Digest · Booking Simulator · Email Monitor · Invoices │
│ Financial Records · Event Scheduler · Data Query · Activity Log │
└───────────────────────┬─────────────────────────┬───────────────┘
│ │
▼ ▼
┌───────────────────────────┐ ┌──────────────────────────┐
│ Booking API :8080 │ │ Analytics API :5001 │
│ backend/main.py │ │ backend/app.py │
│ │ │ │
│ Gemini email extraction │ │ SQLite purchase data │
│ Gemini reply generation │ │ weekly revenue charts │
│ Gemini invoice generation │ │ Prophet demand forecast │
│ in-memory invoice store │ │ OpenAI revenue insights │
└─────────────┬─────────────┘ └────────────┬─────────────┘
▼ ▼
Google Gemini API OpenAI API / Prophet
The client is split across two independent Flask applications because the booking/AI workflow and the analytics/forecasting workflow evolved separately. The frontend calls their localhost URLs directly; there is currently no reverse proxy or shared API gateway.
.
├── frontend/ # Active Vite + React application
│ ├── src/
│ │ ├── App.jsx # Router, sidebar, and page composition
│ │ ├── components/ # Feature pages and shared UI components
│ │ └── utils/agentGraph.js # Experimental client-side Gemini/LangChain flow
│ ├── package.json
│ └── vite.config.js
├── backend/
│ ├── main.py # Booking, email-generation, and invoice API (:8080)
│ ├── gemini_integration.py # Gemini prompts, parsing, and invoice HTML generation
│ ├── app.py # Forecast and revenue API (:5001)
│ ├── forecast.py # Sample-data ETL, SQLite, Prophet model, plot creation
│ ├── revenue.py # Weekly aggregation and OpenAI financial commentary
│ ├── AgenticAI.py # Standalone/legacy IMAP, calendar, invoice, and mail prototype
│ ├── requirements.txt
│ └── Procfile # Waitress entry point for the analytics API
├── src/ # Earlier root-level UI prototype; not the active Vite app
├── public/ # Root-level prototype assets
├── package.json # Root dependency manifest (no application scripts)
└── README.md
frontend/ is the application to run. The root-level src/ directory duplicates several early UI components but has no matching Vite entry point or scripts, so it should be treated as historical prototype code unless the project is consolidated.
| Page | Purpose | Backing data today |
|---|---|---|
| Weekly Financial Digest | Revenue chart, revenue commentary, and demand forecast | Live calls to the analytics API |
| Booking Simulator | End-to-end booking request demo, conflict detection, reply, and invoice generation | Gemini API plus locally seeded calendar events |
| Email Monitor | Demo inbox for reviewing a request, extracting details, and drafting a reply | Mock inbox; Gemini calls for analysis and response text |
| Invoice Manager | Browse, preview, print, and delete invoice records | Booking API's in-memory invoice store with mock fallback invoices |
| Financial Records | Revenue, expenses, profit, invoices, payroll, and reports overview | Static demo data |
| Event Scheduler | Upcoming-event table and scheduling controls | Static demo data |
| Data Query | Natural-language business-intelligence prompt UI | Keyword-based mock responses |
| AI Activity Log | Expandable side panel of recent agent activity | Static demo activity |
Some components—such as Dashboard, CalendarView, and Settings—exist in the repository but are not mounted in the routes defined by frontend/src/App.jsx.
- Node.js 18+ and npm
- Python 3.10+ and
pip - A Gemini API key for the booking AI workflow
- An OpenAI API key for AI revenue commentary (optional; see below)
Create a backend/.env file. Do not commit it.
GEMINI_API_KEY=your_gemini_api_key
OPENAI_API_KEY=your_openai_api_keyGEMINI_API_KEY is needed to initialize the booking API. OPENAI_API_KEY enables the generated revenue analysis; without a working OpenAI request, the UI still receives an error-style fallback insight from the analytics service.
In one terminal:
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python main.pyThis serves Gemini-powered booking and invoice endpoints at http://localhost:8080.
In a second terminal, with the virtual environment active:
cd backend
python app.pyThis serves weekly revenue and forecast endpoints at http://localhost:5001. On startup it recreates the local purchases table with 100,000 randomized sample purchase records spanning 2021–2023, so forecast and revenue results are demo data and change between fresh starts.
In a third terminal:
cd frontend
npm install
npm run devOpen the URL printed by Vite (normally http://localhost:5173). The app redirects / to /weekly-digest.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/reverse |
Small diagnostic endpoint; returns reversed text. |
POST |
/api/analyze-email |
Extracts booking information from { "email_body": "..." }. |
POST |
/api/generate-confirmation |
Generates a confirmation from { "booking_details": { ... } }. |
POST |
/api/generate-rejection |
Generates a rejection and alternatives from booking_details and alternative_slots. |
POST |
/api/generate-invoice |
Generates and stores an invoice from booking_details; accepts optional pricing_info. |
GET |
/api/invoices |
Lists invoices stored during the current process. |
GET |
/api/invoices/:invoice_id |
Retrieves one in-memory invoice. |
Booking details are expected in the backend's snake-case shape, for example:
{
"client_name": "Jordan Lee",
"client_email": "jordan@example.com",
"requested_date": "2026-08-22",
"start_time": "9:00 AM",
"end_time": "3:00 PM",
"purpose": "Product workshop",
"attendees": 30,
"special_requests": "Projector and whiteboard"
}| Method | Endpoint | Description |
|---|---|---|
GET |
/api/forecast |
JSON forecast rows with ds, yhat, yhat_lower, and yhat_upper. |
GET |
/api/forecast-plot |
PNG chart of historical purchases, a one-year forecast, and confidence interval. |
GET |
/api/weekly-revenue |
Weekly revenue records plus an insights string. |
GET |
/api/revenue-plot |
PNG bar chart for revenue over the final sample-data month. |
forecast.py owns a file-backed SQLite database at backend/profit_pilot.db when launched from backend/. It seeds synthetic purchases, groups them by day, trains a Prophet model with weekly/yearly seasonality plus monthly seasonality when sufficient history exists, then forecasts 365 future days. The resulting plot includes a seven-day-smoothed historical series and a 95% prediction interval.
revenue.py queries the final 30 days of that same sample period, groups purchase cost by ISO week, renders the revenue chart, and sends a compact summary to gpt-4o-mini for commentary.
Run these from frontend/:
| Command | Purpose |
|---|---|
npm run dev |
Start the Vite development server. |
npm run build |
Produce a production frontend build in dist/. |
npm run preview |
Serve the production build locally. |
npm run lint |
Run ESLint across the frontend source. |
ProfitPilot is a demo rather than a production-ready booking system. The following behavior is intentionally incomplete or mocked in the current codebase:
- The Email Monitor displays mock messages; saving credentials only writes the address and server to browser
localStorage, and “send” is simulated. - Calendar availability in the Booking Simulator uses seeded browser-side events.
AgenticAI.pycontains a separate IMAP/calendar/mail prototype, but it is not wired into the Flask APIs or UI. - Invoices live in the
main.pyprocess memory and disappear on restart. The invoice manager also supplies mock invoices if the API cannot be reached. - Several dashboards use hard-coded sample values and the Data Query page uses keyword-driven sample answers.
- Both APIs and the frontend use localhost URLs directly. Configuration, authentication, persistence, tenant isolation, and a deployment gateway would be needed for production.
- Keep
.envfiles and all provider keys out of Git. Use environment variables or a secrets manager in deployment. - API keys should remain server-side. The experimental
frontend/src/utils/agentGraph.jsis not part of the routed workflow and should not be used to expose a Gemini key in a browser bundle. - The analytics
Procfilerunsapp:appthrough Waitress. The booking API has no production process definition yet, so deploying the complete app requires deploying both services (or combining them behind a single gateway). - Tighten the development CORS settings and add authentication before accepting real customer or email data.
There is no automated test suite in the repository. npm run lint is configured, but it currently reports existing unused-variable errors and a duplicate declaration in frontend/src/utils/agentGraph.js; these should be resolved before treating lint as a release gate.
Learn more about the project and its HackIllinois submission on Devpost: ProfitPilot.