TerpEats - Order Smart. Eat Fresh. Waste Less.
Inspiration
As University of Maryland students, we witnessed firsthand the daily struggles of campus dining: long lines at peak hours, uncertainty about menu options, and the challenge of maintaining nutritional goals while juggling a busy academic schedule. We saw students either skipping meals or settling for less healthy options simply because they didn't have time to plan ahead.
The inspiration for TerpEats came from a simple observation: what if students could order ahead, see exactly what's available, and get personalized nutrition guidance—all in one place? We wanted to create a solution that not only saves time but also promotes healthier eating habits and reduces food waste by enabling better demand forecasting for dining halls.
What It Does
TerpEats is a comprehensive campus dining platform that revolutionizes how students interact with dining halls:
Core Features:
- Pre-Order System: Students can browse menus from all three UMD dining halls (South Campus, Yahentamitsi, 251 North) and place orders in advance
- Real-Time Menu: Access to 3,149 menu items with detailed nutritional information (calories, protein, carbs, fat)
- Smart Filtering: Filter by dining hall, meal period (breakfast, brunch, lunch, dinner), and search by item name
- AI Nutrition Coach: Gemini-powered chatbot that provides personalized meal recommendations based on your profile (age, height, weight, activity level, and macro goals)
- Order Tracking: Real-time order status updates from "pending" → "in progress" → "ready" → "picked up"
- Kitchen Dashboard: Live view for dining hall staff to manage incoming orders
- Nutrition Tracking: Automatic daily nutrition logging to help students meet their macro goals
- Profile Management: Set and track personal fitness goals with BMR/TDEE calculations
The Math Behind It
We use the Mifflin-St Jeor Equation to calculate Basal Metabolic Rate (BMR):
For Males: $$BMR = 10 \times \text{weight}{kg} + 6.25 \times \text{height}{cm} - 5 \times \text{age} + 5$$
For Females: $$BMR = 10 \times \text{weight}{kg} + 6.25 \times \text{height}{cm} - 5 \times \text{age} - 161$$
Then we calculate Total Daily Energy Expenditure (TDEE): $$TDEE = BMR \times \text{Activity Factor}$$
Where Activity Factor ranges from 1.2 (sedentary) to 1.9 (very active).
How We Built It
Tech Stack:
Frontend:
- React with Vite for fast development and optimal performance
- Tailwind CSS for beautiful, responsive UI with UMD branding (red and gold theme)
- React Router for seamless navigation
- Context API for state management (Auth, Cart)
Backend & Database:
- Supabase (PostgreSQL) for real-time database with Row Level Security
- Supabase Auth for secure user authentication
- Real-time subscriptions for live order updates in the kitchen dashboard
AI Integration:
- Google Gemini 2.5 Flash for personalized nutrition coaching
- Express.js proxy server to handle Gemini API calls server-side (avoiding CORS and securing API keys)
Data Pipeline:
- Scraped 3,149 menu items from UMD dining halls
- CSV processing and normalization
- Dual data source: Supabase (primary) + CSV fallback for reliability
Architecture Highlights:
- Optimized Queries: Limited Supabase queries to 500 items with selective column fetching to prevent resource exhaustion
- Fallback System: 15-second timeout with automatic CSV fallback ensures the app always works
- Real-time Updates: Kitchen dashboard uses Supabase channels for instant order notifications
- Smart Deduplication: Normalized menu items to remove duplicates while preserving meal-period variations
- Imperial Units: User-friendly input (feet/inches, pounds) with automatic metric conversion for calculations
Challenges We Faced
1. Supabase Resource Limits
Problem: ERR_INSUFFICIENT_RESOURCES when querying 3,149 menu items
Solution:
- Reduced query to essential columns only
- Implemented pagination with
.limit(500) - Created CSV fallback system for reliability
- Added 15-second timeout with graceful degradation
2. Gemini API Integration
Problem: Browser CORS restrictions and model endpoint compatibility Solution:
- Built Express.js proxy server to handle API calls server-side
- Upgraded to
@google/generative-aiv0.2.1 for v1 endpoint compatibility - Implemented fallback from
gemini-1.5-flashtogemini-2.5-flash - Added markdown stripping (
**text**→text) for cleaner chat responses
3. Data Normalization
Problem: Inconsistent nutrition data formats (e.g., "total carbohydrate. 0.5g") Solution:
const toNumber = (value) => {
if (typeof value === 'number') return value
const match = String(value).match(/-?\d+(?:\.\d+)?/)
return match ? parseFloat(match[0]) : null
}
4. Order Items Foreign Key Constraint
Problem: Menu items from CSV didn't exist in Supabase menu_items table
Solution:
- Modified
order_itemsschema to store item details directly (name, calories, macros) - Made
menu_item_idnullable - Orders now work independently of menu item database entries
5. React Import Errors
Problem: "React is not defined" errors in JSX files
Solution: Added explicit import React from 'react' to all component files
6. Dining Hall Dropdown Loading
Problem: Dropdown stuck on "Loading dining halls..." Solution: Hardcoded the three UMD dining halls instead of fetching from database for instant availability
7. Cart Clearing Flow
Problem: Empty cart screen showing after order placement Solution: Reordered operations to clear cart → show modal → navigate on button click (not automatically)
Use of AI in Development
We intentionally leveraged AI tools including ChatGPT, Google Gemini, and Cursor AI to enhance our development workflow and code quality throughout the project.
AI was used to:
- Debug complex React and Supabase integration issues
- Suggest optimal UI layouts and component architecture patterns
- Optimize SQL queries and database schema design
- Generate and refine Tailwind CSS styling
- Clean and organize project documentation
- Improve nutrition calculation logic and BMR/TDEE formulas
- Speed up repetitive coding tasks and boilerplate generation
- Parse and normalize inconsistent CSV data formats
- Troubleshoot CORS and API integration challenges
Our Approach:
Every AI-generated code snippet was carefully reviewed, tested, and manually integrated into our codebase. We used AI as a coding assistant to accelerate development and explore solutions, not as a substitute for our own engineering decisions. All architectural choices, feature implementations, and problem-solving strategies were driven by our team's understanding and requirements.
What We Learned
Real-time Systems: Implementing Supabase real-time subscriptions taught us about WebSocket-based architectures and the importance of efficient database queries
API Proxy Patterns: Building a server-side proxy for Gemini API showed us how to handle CORS, secure API keys, and provide fallback mechanisms
Data Resilience: The importance of fallback systems—our CSV backup ensures the app works even when Supabase has issues
User Experience: Small details matter—imperial units, 15-second timeouts, clear error messages, and confirmation screens all contribute to a polished experience
Performance Optimization: Query optimization, selective column fetching, and pagination are crucial for working within free-tier limits
Nutrition Science: Implementing BMR/TDEE calculations and macro tracking gave us deeper insights into nutrition and fitness
What's Next for TerpEats
- Push Notifications: Alert students when their order is ready
- Meal Planning: AI-powered weekly meal plans based on class schedules
- Social Features: Share favorite meals and dining hall reviews
- Analytics Dashboard: Insights for dining hall managers on popular items and peak hours
- Dietary Restrictions: Advanced filtering for allergies, vegetarian, vegan, halal, kosher
- Integration with UMD ID: Seamless payment with dining dollars
- Waste Reduction: Predictive analytics to help dining halls optimize food preparation
- Nutrition Goals Gamification: Streaks, achievements, and challenges for hitting macro goals
Built by students, for students at the University of Maryland.
Order Smart. Eat Fresh. Waste Less.
Built With
- 2.5
- ai
- anguages:
- api
- apis:
- auth
- branding
- channels)
- context
- css
- csv
- data
- database)
- design:
- express.js
- flash)
- frameworks
- gemini
- generative
- html/css
- javascript
- level
- libraries:
- maryland
- node.js
- of
- platforms
- postgresql
- processing
- react
- react)
- realtime
- rest
- rls)
- router
- row
- security
- services:
- sql
- supabase
- tailwind
- technologies:
- tools
- university
- vite
- websockets
Log in or sign up for Devpost to join the conversation.