Autonomous AI Supplier Price Tracking, Margin Leakage Detection & Automated Invoice Auditing for Hospitality and Multi-Venue Operators.
Architecture • Key Features • Tech Stack • Quick Start • Cloud Run Deployment • Google Auth Setup • Security
PriceShield protects restaurant, hotel, bar, and hospitality profit margins by continuously monitoring vendor pricing on wholesale invoices. By automatically ingesting typed PDFs, paper receipts, or auto-forwarded supplier emails (Cheney Bros, Sysco, US Foods, PFG, GFS, etc.), PriceShield performs semantic line-item SKU reconciliation, calculates cost creep variances against historic baselines, and alerts operators immediately via Telegram, Slack, WhatsApp, or Email before invoices are settled.
- Automated AI Invoice Extraction: Sub-5-second OCR pipeline capable of extracting item names, quantities, unit prices, SKU identifiers, and taxes with 97%+ accuracy.
- Semantic SKU Matching & Price Creep Engine: Reconciles renamed vendor line items (e.g.,
"Prime Beef Tenderloin"vs"USDA Beef Tenderloin") and calculates variances against baseline contracts. - Real-Time Omnichannel Alerting: Push actionable alerts directly to Telegram channels, Slack webhooks, WhatsApp, or email digests (daily, weekly, monthly).
- Auto-Forward Ingestion: Dedicated email inbox integration for hands-free auditing.
- AI CFO Assistant: Natural language insights and conversational intelligence for food cost percentages, margin leakage, and vendor negotiation leverage.
- Enterprise Multi-Location Isolation: Row-Level Security (RLS) ensures clean data partition across venue locations.
graph TD
subgraph Client Layer
A[Next.js 16 Web Dashboard]
B[Telegram / Slack / Email Ingestion]
end
subgraph Firebase & Cloud Run
C[Firebase App Hosting] -->|Serves Web UI| A
D[Cloud Run: FastAPI Backend]
end
subgraph Data & AI Infrastructure
E[(Supabase PostgreSQL 17 + pgvector)]
F[Google Vertex AI / Gemini 2.5]
end
A -->|Auth & Queries| E
A -->|API Operations| D
B -->|Webhooks / Parsing| D
D -->|Semantic SKU Vector Match| E
D -->|Invoice Multimodal Extraction| F
D -->|Realtime Notifications| B
- Frontend: Next.js 16 (App Router, Turbopack, React 19, TypeScript, Tailwind CSS, Lucide Icons, Framer Motion)
- Backend API: Python 3.13, FastAPI, Uvicorn, Pydantic v2, PyPDFium2, Psycopg2
- Database & Auth: Supabase PostgreSQL 17,
pgvector, Row-Level Security (RLS), Supabase GoTrue Auth (Google OAuth2 + Magic Links) - AI / LLM Ingestion: Google Cloud Vertex AI (
gemini-2.5-flash), multimodal document extraction - Hosting & Infra: Google Cloud Run (Containerized API), Firebase App Hosting (SSR Web Client)
- Node.js >= 20.x
- Python >= 3.11
- Docker (optional, for local container runs)
- Supabase Project (supabase.com)
git clone https://github.com/personaliai/PriceShield.git
cd PriceShieldExecute the schema migration script in your Supabase SQL editor:
# File located at backend/schema.sqlcd frontend
cp .env.example .env.local
npm install
npm run devcd backend
python -m venv .venv
# Windows:
.venv\Scripts\activate
# Linux/macOS:
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reloadBuild and deploy the containerized FastAPI service with a single command:
# 1. Authenticate with Google Cloud
gcloud auth login
gcloud config set project YOUR_GCP_PROJECT_ID
# 2. Build and Deploy Container to Cloud Run
gcloud run deploy priceshield-api \
--source ./backend \
--region us-central1 \
--platform managed \
--allow-unauthenticated \
--set-env-vars "\
SUPABASE_URL=https://<your-project>.supabase.co,\
SUPABASE_ANON_KEY=<your-anon-key>,\
SUPABASE_SERVICE_ROLE_KEY=<your-service-role-key>,\
DATABASE_URL=postgresql://postgres.<ref>:<password>@aws-0-ap-southeast-1.pooler.supabase.com:5432/postgres,\
GCP_PROJECT_ID=YOUR_GCP_PROJECT_ID,\
PRICE_VARIANCE_THRESHOLD=2.0"- Push your repository to your GitHub organization (
personaliai/PriceShield). - Go to the Firebase Console -> App Hosting.
- Click Get Started, connect the
personaliai/PriceShieldGitHub repository. - Set root directory to
frontendor root (utilizingapphosting.yaml). - Configure the environment variables in Firebase App Hosting settings or
apphosting.yaml.
Follow these exact steps to enable Google Sign-In with Supabase Auth:
- Go to Google Cloud Console Credentials.
- Select your GCP project.
- Configure the OAuth Consent Screen (User Type: External, add App Name and Developer Contact).
- Navigate to Credentials -> Create Credentials -> OAuth client ID.
- Select Application type: Web application.
- Under Authorized redirect URIs, add your Supabase Auth callback URI:
https://<your-supabase-project-id>.supabase.co/auth/v1/callback - Click Create and copy the generated Client ID and Client Secret.
- In your Supabase Dashboard, navigate to Authentication -> Providers.
- Locate Google and switch it to Enabled.
- Paste the Client ID and Client Secret obtained from GCP.
- Under Authentication -> URL Configuration:
- Set Site URL:
https://your-domain.com(orhttp://localhost:3000for development). - Add to Redirect URLs:
https://your-domain.com/** https://*.hosted.app/** http://localhost:3000/**
- Set Site URL:
- Click Save. Google OAuth authentication is now live!
This project enforces strict security boundaries suitable for open-source repositories:
- Zero Tracked Secrets:
.gitignorestrictly protects.env,.env.local,firebase-service-account.json, and credentials files. - Client-Safe Keys Only: Only public
NEXT_PUBLIC_variables (Supabase URL and Anon Key with RLS enabled) are bundled in the client code. - Row-Level Security (RLS): Direct database queries from frontend clients are isolated by authenticated
auth.uid() = user_id. - Pre-commit Scan Recommendation: Use
gitleaksortrufflehoglocally before pushing commits:gitleaks detect --source . -v
Distributed under the MIT License. See LICENSE for more details.