Skip to content

anandhukrishnaas1/OpenTable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

49 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

🍽️ OpenTable β€” AI-Powered Food Rescue Platform

Eliminating food waste by connecting surplus food with communities in need.

React TypeScript Firebase Gemini AI Vite Cloudinary License: MIT Deploy CI

🌐 Live Demo Β· πŸ“ Report Bug Β· ✨ Request Feature


πŸ“‹ Table of Contents


πŸ“Έ Screenshots

Landing Page AI Food Scanner Volunteer Dashboard
Landing AI-powered food analysis with category detection Browse pickups, claim deliveries, upload proof
Donor Dashboard Admin Panel Transparency Ledger
Scan food, list donations, track pickups Approve volunteers, review deliveries Public accountability log

🎯 Problem Statement

1.3 billion tons of food is wasted globally every year, while 827 million people go hungry. A massive portion of edible food from restaurants, caterers, and households is thrown away simply because there is no efficient system to redistribute it in time.

The Gap

Challenge Impact
No real-time visibility into surplus food Edible food expires before it reaches people
Manual coordination between donors & volunteers Delays cause spoilage
No quality verification for food safety Trust issues prevent participation
No accountability in the delivery chain Donors can't verify food reached the right people

Your chosen vertical

Vertical: Social Good / Environmental Sustainability (Food Tech)

Problem Statement Alignment: We chose this vertical precisely because the problem of food waste (1.3 billion tons annually) combined with global hunger (827 million people) is an incredibly solvable logistical problem. OpenTable aligns directly with this problem statement by providing a real-time, AI-driven coordination platform that removes the friction from food donation and eliminates the trust barrier for volunteers, ensuring surplus food reaches those in need before it spoils.


Approach and logic

Our approach focuses on removing friction for food donors and building trust in the volunteer network.

Logic:

  1. Donor Friction: Restaurants won't donate if it takes 10 minutes to fill out a form. We use Google Gemini AI to let them just snap a photoβ€”the AI fills in the category, quantity estimates, and safety tags automatically.
  2. Trust & Safety: Charities won't accept food from unvetted strangers. We built an identity verification system and a digital "chain of custody" where every pickup and delivery is logged with photo proof.
  3. Real-time Sync: Food spoils fast. We use Firebase Firestore to ensure the moment a donor lists food, every volunteer's feed updates instantly without refreshing.

How the solution works

OpenTable is an AI-powered, real-time food rescue platform that creates a seamless bridge between food donors (restaurants, caterers, households) and communities in need, coordinated by verified volunteers.

The Complete Flow

graph LR
    A[πŸͺ Donor uploads food photo] --> B[πŸ€– Gemini AI analyzes & categorizes]
    B --> C[πŸ“‹ Listed on real-time feed]
    C --> D[πŸ™‹ Verified volunteer claims pickup]
    D --> E[πŸ“Έ Volunteer delivers & uploads proof]
    E --> F[βœ… Admin reviews & applauds]
Loading

Feature Roles

  • Donors: Snap a photo of surplus food. Google Gemini AI automatically categorizes it and adds safety context. The donation is broadcasted via Firebase to all nearby volunteers instantly.
  • Volunteers: Must submit ID and selfie for admin verification. Once approved, they see an active feed of available pickups, accept a task, get Google Maps directions, and must upload photo proof of the final delivery.
  • Admins: Oversee the entire ecosystem. They approve/reject volunteer verifications, audit the delivery proofs, and can "clap" (reward) volunteers for completed drives.

Any assumptions made

  1. Internet Access: We assume both donors and volunteers have reliable internet access and smartphone cameras to take photos of the food and delivery proofs.
  2. Platform Moderation: We assume there is a dedicated Admin team available to review volunteer applications in a timely manner so bottlenecks don't occur.
  3. Local Geography: Initially, we assume operations are within a single metropolitan area, meaning any volunteer seeing the feed is reasonably close to the donation pickups (Google Maps handles the exact routing).
  4. Food Safety Norms: We assume donors are following basic local health regulations before deciding an item is fit for donation.

πŸ’‘ Key Features

πŸͺ For Donors

  • AI Food Scanner β€” Snap a photo β†’ Gemini AI identifies the food, category, freshness level, and safety window
  • One-Tap Listing β€” Add quantity, contact, location β†’ donation goes live instantly
  • Live Tracking β€” See when your donation is claimed and delivered in real-time
  • GPS Integration β€” Auto-detect location for faster listing

πŸ™‹ For Volunteers

  • Available Pickups Feed β€” Browse all active food donations nearby
  • One-Click Claim β€” Accept a pickup and get directions via Google Maps
  • Delivery Proof β€” Camera integration to photograph delivery for accountability
  • Completed Tab β€” Track all past deliveries and see admin πŸ‘ recognition
  • One-Time Verification β€” Verify identity once, accept unlimited deliveries

πŸ›‘οΈ For Admins

  • Approval Dashboard β€” Review volunteer identity verification requests (ID photo + selfie)
  • Trust Scoring β€” Assign trust scores to volunteers
  • Completed Deliveries β€” View all delivery proof photos
  • Clap Recognition β€” πŸ‘ Applaud volunteers for successful deliveries
  • Status Management β€” Approve, Flag, or Reject volunteer applications

πŸ€– AI-Powered Features

  • Food Image Recognition β€” Category detection (produce, dairy, bakery, prepared meals, etc.)
  • Freshness Analysis β€” AI estimates remaining shelf life and safety parameters
  • Smart Categorization β€” Auto-fill donation details for faster listing

πŸ— Architecture

graph TB
    subgraph Frontend["React Frontend (Vite + TypeScript)"]
        LP[Landing Page] --> Auth[Firebase Auth]
        Auth --> RS[Role Selection]
        RS --> DD[Donor Dashboard]
        RS --> VD[Volunteer Dashboard]
        RS --> AD[Admin Dashboard]
    end

    subgraph Services["External Services"]
        Gemini[Google Gemini AI]
        Cloud[Cloudinary CDN]
        FS[Firebase Firestore]
        FA[Firebase Auth]
    end

    DD -->|"Food Analysis"| Gemini
    DD -->|"Image Upload"| Cloud
    DD -->|"Save Donation"| FS
    VD -->|"Delivery Proof"| Cloud
    VD -->|"Update Status"| FS
    AD -->|"Read/Write"| FS

    style Frontend fill:#1a1a2e,stroke:#16213e,color:#fff
    style Services fill:#0f3460,stroke:#16213e,color:#fff
Loading

Data Flow

Collection Purpose Key Fields
users User profiles & roles uid, email, role, name
donations Food donation listings item, status, imageUrl, deliveryProofUrl, clappedByAdmin
volunteersrequest Volunteer verification idImageUrl, selfieUrl, status, trustScore

πŸ›  Tech Stack

Layer Technology Purpose
Framework React 19 + TypeScript Component-based UI with type safety
Build Tool Vite 6 Lightning-fast HMR & optimized builds
Styling Tailwind CSS Utility-first responsive design
Database Firebase Firestore Real-time NoSQL database
Authentication Firebase Auth Google OAuth + Email/Password
AI Google Gemini 2.0 Flash Multimodal food image analysis
Image CDN Cloudinary Optimized image storage & delivery
**Serverless Image CDN Cloudinary
Icons Lucide React Consistent icon system
Deployment Vercel Edge-optimized hosting
PWA vite-plugin-pwa Progressive Web App capabilities

πŸ“ Project Structure

OpenTable/
β”œβ”€β”€ .github/                     # GitHub templates
β”‚   β”œβ”€β”€ ISSUE_TEMPLATE/
β”‚   β”‚   β”œβ”€β”€ bug_report.md        # Bug report template
β”‚   β”‚   └── feature_request.md   # Feature request template
β”‚   └── PULL_REQUEST_TEMPLATE.md # PR checklist template
β”œβ”€β”€ public/                      # Static assets (logo, carousel images)
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/              # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ DoodleBackground.tsx # Decorative background component
β”‚   β”‚   β”œβ”€β”€ ErrorBoundary.tsx    # Global error boundary with retry
β”‚   β”‚   β”œβ”€β”€ Layout.tsx           # App shell with navigation & footer
β”‚   β”‚   └── Toast.tsx            # Custom toast notification system
β”‚   β”œβ”€β”€ config/                  # Application configuration
β”‚   β”‚   β”œβ”€β”€ env.ts               # Environment variable validation
β”‚   β”‚   └── index.ts             # Config barrel exports
β”‚   β”œβ”€β”€ constants/               # App-wide constants & enums
β”‚   β”‚   └── index.ts             # Routes, roles, API URLs, collections
β”‚   β”œβ”€β”€ contexts/                # React Context providers
β”‚   β”‚   β”œβ”€β”€ AdminContext.tsx     # Volunteer applications & admin actions
β”‚   β”‚   β”œβ”€β”€ AuthContext.tsx      # Authentication state & role management
β”‚   β”‚   └── DonationContext.tsx  # Donation CRUD & real-time sync
β”‚   β”œβ”€β”€ hooks/                   # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ index.ts             # Hook barrel exports
β”‚   β”‚   β”œβ”€β”€ useLocalStorage.ts   # Persistent state in localStorage
β”‚   β”‚   β”œβ”€β”€ useMediaQuery.ts     # Responsive breakpoint detection
β”‚   β”‚   └── useToast.ts          # Toast notification management
β”‚   β”œβ”€β”€ pages/                   # Route-level page components
β”‚   β”‚   β”œβ”€β”€ AdminDashboard.tsx   # Approve volunteers, view deliveries
β”‚   β”‚   β”œβ”€β”€ DashboardSelection.tsx # Dashboard type selector
β”‚   β”‚   β”œβ”€β”€ DonorDashboard.tsx   # AI scan, list donations, track
β”‚   β”‚   β”œβ”€β”€ LandingPage.tsx      # Hero, features, animated landing
β”‚   β”‚   β”œβ”€β”€ LoginPage.tsx        # Auth (Google + Email/Password)
β”‚   β”‚   β”œβ”€β”€ OnboardingApplication.tsx # Volunteer identity verification
β”‚   β”‚   β”œβ”€β”€ RoleSelection.tsx    # Post-login role picker
β”‚   β”‚   β”œβ”€β”€ TransparencyLedger.tsx    # Public donation activity log
β”‚   β”‚   └── VolunteerDashboard.tsx    # Browse, claim, deliver, proof
β”‚   β”œβ”€β”€ services/                # External service integrations
β”‚   β”‚   β”œβ”€β”€ cloudinary.ts        # Cloudinary image upload service
β”‚   β”‚   β”œβ”€β”€ firebase.ts          # Firebase initialization & helpers
β”‚   β”‚   └── geminiService.ts     # Google Gemini AI integration
β”‚   β”œβ”€β”€ utils/                   # Shared utility functions
β”‚   β”‚   β”œβ”€β”€ cn.ts                # CSS class name combiner
β”‚   β”‚   β”œβ”€β”€ date.ts              # Date formatting & relative time
β”‚   β”‚   β”œβ”€β”€ image.ts             # Image processing & compression
β”‚   β”‚   └── index.ts             # Utility barrel exports
β”‚   β”œβ”€β”€ App.tsx                  # Route definitions with lazy loading
β”‚   β”œβ”€β”€ index.tsx                # React DOM entry point
β”‚   └── types.ts                 # Shared TypeScript type definitions
β”œβ”€β”€ .editorconfig                # Editor formatting standards
β”œβ”€β”€ .env.example                 # Environment variable template
β”œβ”€β”€ .eslintrc.js                 # ESLint configuration
β”œβ”€β”€ .gitignore                   # Git ignore rules
β”œβ”€β”€ .prettierrc                  # Prettier code formatting config
β”œβ”€β”€ CHANGELOG.md                 # Version history (Keep a Changelog)
β”œβ”€β”€ CODE_OF_CONDUCT.md           # Contributor Covenant CoC
β”œβ”€β”€ CONTRIBUTING.md              # Contribution guidelines
β”œβ”€β”€ LICENSE                      # MIT License
β”œβ”€β”€ SECURITY.md                  # Security policy & reporting
β”œβ”€β”€ firestore.rules              # Firebase security rules
β”œβ”€β”€ package.json                 # Dependencies & scripts
β”œβ”€β”€ tsconfig.json                # TypeScript configuration (strict)
β”œβ”€β”€ vercel.json                  # Deployment config with caching
└── vite.config.ts               # Vite build configuration

πŸš€ Getting Started

Prerequisites

Installation

# 1. Clone the repository
git clone https://github.com/anandhukrishnaas1/OpenTable.git
cd OpenTable

# 2. Install dependencies
npm install

# 3. Set up environment variables (see section below)
cp .env.example .env

# 4. Start the development server
npm run dev

The app will be available at http://localhost:5173

Build for Production

npm run build
npm run preview

πŸ” Environment Variables

Create a .env file in the root directory with the following variables:

Variable Description Required
VITE_FIREBASE_API_KEY Firebase project API key βœ…
VITE_OPENROUTER_API_KEY OpenRouter API key for Gemini AI βœ…
VITE_CLOUDINARY_CLOUD_NAME Cloudinary cloud name βœ…
VITE_CLOUDINARY_UPLOAD_PRESET Cloudinary unsigned upload preset βœ…
VITE_FIREBASE_API_KEY=your_firebase_api_key
VITE_OPENROUTER_API_KEY=your_openrouter_api_key
VITE_CLOUDINARY_CLOUD_NAME=your_cloud_name
VITE_CLOUDINARY_UPLOAD_PRESET=your_upload_preset

⚠️ Security: The .env file is gitignored. Never commit API keys to version control.


πŸ§ͺ Testing

OpenTable uses Vitest for unit and integration testing.

Run Tests

# Run all tests once
npm run test

# Run tests in watch mode (re-runs on file changes)
npm run test:watch

# Run tests with coverage report
npm run test:coverage

Test Structure

src/__tests__/
β”œβ”€β”€ setup.ts           # Test environment setup (matchMedia & localStorage mocks)
└── utils.test.ts      # Unit tests for date, image, and className utilities

Validation Pipeline

# Run all quality checks (typecheck + lint + format + test)
npm run validate

πŸ‘₯ User Roles & Flows

Role Hierarchy

graph TD
    U[New User] -->|Sign Up| RS[Role Selection]
    RS -->|"I want to donate"| D[Donor]
    RS -->|"I want to volunteer"| V[Volunteer]
    
    D -->|"Scan & List Food"| DD[Donor Dashboard]
    V -->|"Must verify first"| OB[Onboarding Form]
    OB -->|"Submit ID + Selfie"| Admin[Admin Review]
    Admin -->|"Approve βœ…"| VD[Volunteer Dashboard]
    Admin -->|"Reject ❌"| OB
    
    style D fill:#22c55e,color:#fff
    style V fill:#3b82f6,color:#fff
    style Admin fill:#f97316,color:#fff
Loading

Donor Flow

  1. Sign up / Login β†’ Select "Donor" role
  2. Take a photo of food β†’ AI analyzes it
  3. Add quantity, contact, address β†’ Submit donation
  4. Track when volunteer picks it up

Volunteer Flow

  1. Sign up / Login β†’ Select "Volunteer" role
  2. Complete identity verification (ID photo + selfie)
  3. Admin reviews & approves (one-time process)
  4. Browse available pickups β†’ Claim β†’ Deliver β†’ Upload proof photo
  5. See completed deliveries & admin recognition

Admin Flow

  1. Login with admin account
  2. Review pending volunteer verifications
  3. Approve / Flag / Reject applications
  4. View completed deliveries & delivery proof photos
  5. πŸ‘ Clap for outstanding volunteers

πŸ€– AI Integration

OpenTable uses Google's Gemini 2.0 Flash model via OpenRouter for intelligent food analysis:

// Example AI prompt structure
const prompt = `Analyze this food image and provide:
- Food item name
- Category (produce, dairy, bakery, prepared, etc.)
- Estimated freshness condition
- Safe distribution window
- Storage recommendations`;

AI Capabilities

Feature Description
Food Recognition Identifies food type from photos
Category Detection Auto-categorizes into food groups
Freshness Estimation AI-assessed quality and safety
Smart Pre-fill Auto-populates donation form fields

οΏ½ API Reference

For detailed API documentation of all external service integrations, see docs/API.md.

For architecture diagrams and design decisions, see docs/ARCHITECTURE.md.


οΏ½πŸ”’ Security

Layer Implementation
Authentication Firebase Auth (Google OAuth + Email/Password)
Authorization Role-based access (user, volunteer, admin)
Database Rules Firestore rules require request.auth != null for all operations
API Keys Stored in environment variables, never committed to git
Image Storage Cloudinary with unsigned upload presets (no API secret exposed)
Identity Verification ID photo + selfie required for volunteer approval

⚑ Performance Optimizations

Optimization Impact
React.lazy + Suspense ~60-70% reduction in initial bundle size via code splitting
Preconnect hints 200-500ms faster first API calls (Firebase, Cloudinary, Fonts)
Browser caching (vercel.json) JS/CSS cached 1 year; images cached 1 day with stale-while-revalidate
Cloudinary CDN Images served from nearest edge node
Vite build Tree-shaking, minification, chunk splitting
Firebase onSnapshot Real-time sync without polling

🌐 Browser Compatibility

Browser Supported Notes
Chrome 90+ βœ… Recommended
Firefox 90+ βœ… Full support
Safari 15+ βœ… Full support
Edge 90+ βœ… Full support
Mobile Chrome βœ… PWA installable
Mobile Safari βœ… PWA installable

πŸ—ΊοΈ Roadmap

  • AI-powered food scanning with Gemini
  • Volunteer identity verification system
  • Admin dashboard with clap recognition
  • Real-time donation tracking
  • Progressive Web App (PWA) support
  • Push notifications for new donations
  • Geo-based donation matching (nearest volunteer)
  • Multi-language support (i18n)
  • Donor impact analytics dashboard
  • Mobile-native app (React Native)

❓ Troubleshooting

Build fails with "Missing environment variables"

Ensure all required variables are set in your .env file. Copy from the template:

cp .env.example .env

Then fill in your API keys. See Environment Variables for details.

Firebase Auth not working
  1. Ensure your Firebase project has Authentication enabled
  2. Enable the Google and Email/Password sign-in providers
  3. Add your domain (localhost for development) to the authorized domains list in Firebase Console β†’ Authentication β†’ Settings
AI food scanning returns "Unknown Item"
  1. Verify your VITE_OPENROUTER_API_KEY is valid
  2. Check that you have sufficient credits on OpenRouter
  3. Ensure the image is clear and well-lit for best AI results
Cloudinary upload fails
  1. Verify VITE_CLOUDINARY_CLOUD_NAME matches your Cloudinary account
  2. Ensure the upload preset (VITE_CLOUDINARY_UPLOAD_PRESET) exists and is set to unsigned
  3. Check your Cloudinary plan's upload limits
Tests failing after fresh clone
# Clean install dependencies
rm -rf node_modules package-lock.json
npm install

# Run tests
npm run test

🀝 Contributing

Contributions are welcome! Please read our Contributing Guidelines before getting started.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

See CONTRIBUTING.md for detailed guidelines on code style, commit conventions, and PR requirements.


πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


πŸš€ Deployment

Deploy to Vercel (Recommended)

  1. Push your code to GitHub
  2. Go to vercel.com and import your repository
  3. Set the environment variables in the Vercel dashboard:
    • VITE_FIREBASE_API_KEY
    • VITE_OPENROUTER_API_KEY
    • VITE_CLOUDINARY_CLOUD_NAME
    • VITE_CLOUDINARY_UPLOAD_PRESET
  4. Deploy β€” Vercel auto-detects Vite and configures the build

Manual Deployment

# Build for production
npm run build

# Preview locally
npm run preview

The dist/ folder can be deployed to any static hosting provider (Netlify, AWS S3, Firebase Hosting, etc.).


❓ FAQ

Q: How do I get a Gemini AI API key?

Sign up at OpenRouter and generate an API key. OpenTable uses the google/gemini-2.5-flash model via OpenRouter's unified API.

Q: Can I run this without AI features?

Yes β€” the app works without the AI key, but the food scanning feature will be disabled. All other features (listing, claiming, delivery) work independently.

Q: How do I become an admin?

Manually set the role field to "admin" in the user's Firestore document under the users collection.

Q: Is this project PWA-compatible?

Yes! OpenTable is configured as a Progressive Web App via vite-plugin-pwa. Users can install it on mobile and desktop for an app-like experience.

Q: How do I configure Firebase?
  1. Create a Firebase project at console.firebase.google.com
  2. Enable Authentication (Google + Email/Password providers)
  3. Create a Firestore database
  4. Copy the API key and add it to your .env file

πŸ™ Acknowledgements


Built with ❀️ to fight food waste

OpenTable β€” Every meal matters.

6. Evaluation Focus Areas

  • Code Quality: The project is structured component-by-component in React/TypeScript. Global states are isolated into context hooks (useDonations, useAuth, useAdmin), and component internals leverage hooks like useMemo and useCallback to prevent unnecessary re-rendering.
  • Security: Authentication is firmly walled behind Firebase Auth. Firestore Security Rules enforce document access (only admins can approve volunteers, and only identical donors can edit their donations) which limits common risk vectors.
  • Efficiency: The React single-page app utilizes lazy loading for main dashboard routes. Components only fetch data when absolutely necessary. Images are actively compressed and stored efficiently.
  • Testing: The test suite provides comprehensive test coverage (npm run test -- --coverage) covering hooks, services, types, edge cases and integration APIs.
  • Accessibility: Toast popups include role="alert" and aria-live="assertive". All image tags use valid alt text. The layout utilizes distinct semantic contrast and scaling support for screen readers.
  • Google Services: The application utilizes Google Services extensively across all workflows:
    • Firebase Auth (Google OAuth & Email) for secure user access control.
    • Firebase Firestore for real-time NO-SQL database synchronization across all volunteer & donor peers.
    • Google Gemini 2.0 (via OpenRouter) for sophisticated AI/ML image processing of food categories and autonomous expiry analysis.
    • Google Maps API (Client-side) for location generation and seamless navigation for volunteers claiming deliveries.

GitHub Repository Link

This project's code is fully open-source and hosted publicly at: https://github.com/anandhukrishnaas1/OpenTable

About

AI powered food rescue platform that connects donors and volunteers with real time tracking, verification, and intelligent food analysis

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors