Overview
Perfect Portion is an award-winning iOS application that redefines nutrition tracking by leveraging AI to eliminate manual data entry. Instead of tediously searching for food items, users simply take a picture of their meal, and our system automatically identifies the food, estimates serving sizes, and returns detailed nutritional information. This project was conceived and built in under 24 hours for HackPSU Fall 2023, where it won 1st Place Overall, the "Most Creative Use of GitHub" award, and the NittanyAI award.
The core problem we addressed is the high friction associated with traditional diet apps, which discourages consistent use. Studies show that consistent food logging can double weight loss results, yet adoption remains low. Perfect Portion provides a seamless, "snap-and-track" experience, making it effortless for health-conscious individuals to stay informed about their dietary choices. As the Lead Developer for Backend and Infrastructure, I engineered the core API that gathers and processes responses from machine learning algorithms and generative AI. I also deployed our services on a multi-node K3S cluster with redundant locations, ensuring safe and efficient hosting for our API and front-end.
Key Features
-
AI-Powered Food Recognition: Utilizes the LogMeal image segmentation API to accurately identify multiple food items within a single photograph, forming the core of our automated logging pipeline.
-
Instant Nutritional Analysis: Once food is identified, the app provides a clean, readable breakdown of key nutritional data, including calories, macronutrients, and more, enabling users to make informed decisions at a glance.
-
Intuitive & Accessible UI: Designed with a minimalist philosophy and adherence to WCAG/ADA guidelines, the SwiftUI interface features large touch targets, high-contrast text, and a logical flow to ensure a frictionless experience for all users.
-
Scalable Backend Infrastructure: The application is supported by a resilient, multi-node Kubernetes cluster hosted on Oracle Cloud, ensuring high availability and low latency for users across different regions.
Technologies & Implementation
We architected a full-stack solution designed for speed, scalability, and accuracy within the 24-hour hackathon timeframe. The technology stack was chosen to enable rapid development while building a robust and production-ready foundation.
-
Frontend: A native iOS application built with SwiftUI to deliver a responsive and polished user experience that integrates seamlessly with the Apple ecosystem.
-
Backend: A custom API built with Node.js and Express, serving as the central orchestrator. It manages requests from the iOS client, interfaces with the machine learning services, and parses complex data into a simple format for the frontend.
-
Infrastructure: The backend is deployed on a multi-node K3S Kubernetes cluster managed with Rancher on Oracle Cloud Infrastructure (OCI). This multi-region setup (US West & US East) was critical for ensuring low latency and providing redundancy.
-
AI & Machine Learning: We integrated the LogMeal API for its powerful food image segmentation capabilities and leveraged the OpenAI (GPT-3.5) API for data enrichment and parsing tasks.
The system's architecture ensures a clean separation of concerns, allowing the iOS client to remain lightweight while the heavy processing is offloaded to the scalable backend.
graph TD
A["iOS Client (SwiftUI)"] --"Image Upload (HTTPS)"--> B["Node.js API Gateway (Express)"]
B --"Sends Image"--> C["LogMeal Image Segmentation API"]
C --"Returns Food Data (JSON)"--> B
B --"Processes & Enriches Data"--> D["OpenAI API (Optional)"]
D --"Returns Refined Info"--> B
B --"Formatted Nutritional Data (JSON)"--> A
Challenges & Solutions
The primary technical challenge was architecting and deploying a complex, multi-service pipeline from scratch in under 24 hours. A significant part of this involved identifying and integrating the right AI services for food segmentation and identification. Finding tools that were both powerful enough for the task and simple enough to implement within the deadline was a critical hurdle. Furthermore, several team members were new to collaborative development tools like Git and the high-pressure hackathon environment.
To overcome this, we adopted a clear mentorship structure and a focused technical strategy. As the lead on backend and AI, my focus was on architecting the data pipeline and selecting the optimal tools—LogMeal and OpenAI—to form our core AI engine. We established a streamlined API contract early on, which proved essential. It decoupled frontend and backend development, allowing our iOS and infrastructure teams to work in parallel without blocking each other. This combination of a well-defined architecture and a collaborative workflow was instrumental in our ability to deliver a fully functional and polished product within the deadline.
Results & Impact
The project was a resounding success, achieving both our functional goals and receiving significant recognition from the judges.
-
1st Place Winner at HackPSU Fall 2023: Placed first among a highly competitive field of projects.
-
Awarded "Most Creative Use of GitHub" and "NittanyAI": Recognized for our collaborative workflow and innovative application of artificial intelligence.
-
Fully Functional Prototype: We successfully built a working end-to-end image recognition pipeline that delivered accurate nutritional data with low latency in less than 24 hours.
-
Future Roadmap: We've outlined a clear path for future development, including integration with the FDA FoodData database for enhanced accuracy, barcode scanning for packaged goods, and cross-platform deployment to Android and the web.
{TODO: Add screenshot of the Perfect Portion app interface identifying a meal}
