Skip to content

Boredoom17/SmartCooking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍽️ NUTRISNAP

Smart Recipe Finder from Your Ingredients

React Native TypeScript Expo Python Flask Supabase

Snap Ingredients β€’ Get Recipes β€’ Start Cooking


πŸ“– Overview

NUTRISNAP is a mobile application designed for students and individuals living alone who want to make the most of their available ingredients. Simply snap a photo of what you have in your kitchen, and NUTRISNAP will suggest recipes you can make, ranked by how well your ingredients match each recipe.

Built with a custom-trained YOLOv8n model for ingredient recognition and a curated database of Nepali and Western recipes, NUTRISNAP helps you discover cooking possibilities without the hassle of manual ingredient entry.

✨ Key Features

  • πŸ” User Authentication - Secure login and session management with Supabase
  • πŸ“Έ Ingredient Recognition - Snap photos to automatically identify ingredients
  • 🎯 Smart Recipe Matching - Recipes ranked by ingredient match percentage
  • 🍲 Curated Recipe Database - 30-40 Nepali and Western recipes
  • ✏️ Editable Results - Refine recognized ingredients before searching
  • πŸ“œ Scan History - View your last 10-15 ingredient scans
  • πŸ“± Cross-Platform - Works on both iOS and Android
  • ⚑ Fast & Lightweight - Optimized for quick results

🎯 How It Works

graph LR
    A[Sign In] --> B[Take Photo]
    B --> C[YOLOv8n Recognition]
    C --> D[Edit Ingredients]
    D --> E[Match Recipes]
    E --> F[View Results]
    F --> G[Start Cooking!]
Loading

User Flow

  1. Sign In

    • Create an account or log in with existing credentials
    • Secure authentication via Supabase
  2. Capture Ingredients

    • Open the app and tap the camera button
    • Snap a photo of your ingredients
    • AI identifies what's in the image
  3. Review & Refine

    • Check recognized ingredients
    • Edit or remove any incorrect items
    • Add missing ingredients if needed
  4. Get Recipe Suggestions

    • View recipes sorted by match percentage
    • Recipes requiring your ingredients appear first
    • Partial matches shown below
  5. Cook Your Meal

    • Follow step-by-step instructions
    • Access your scan history anytime

πŸ› οΈ Tech Stack

Frontend

  • React Native - Cross-platform mobile framework
  • TypeScript - Type-safe development
  • Expo (SDK 52) - Build and deployment tools
  • React Navigation - Screen navigation
  • Expo ImagePicker - Camera and gallery access

Backend

  • Flask - Python web framework
  • Supabase - Database and authentication service
  • YOLOv8n - Custom-trained object detection model
  • OpenCV - Image processing
  • NumPy - Numerical computations

Data & Storage

  • Supabase - PostgreSQL database for user data, recipes, and authentication
  • AsyncStorage - Local history persistence
  • Custom ML Model - 13 ingredient classes (custom-annotated dataset)

API Communication

  • Axios - HTTP client for API requests
  • RESTful API - Flask backend endpoints
  • Base64 Encoding - Image transfer format

πŸš€ Quick Start

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • Expo CLI (npm install -g expo-cli)
  • iOS Simulator (Mac) or Android Studio
  • Python 3.11+ (for backend)
  • Supabase account (for database and authentication)

Frontend Setup

  1. Clone the repository
git clone https://github.com/Boredoom17/SmartCooking.git
cd SmartCooking/SmartCookingStable
  1. Install dependencies
npm install
# or
yarn install
  1. Configure environment variables

    Create a .env file:

API_URL=http://your-backend-url:5000
EXPO_PUBLIC_API_URL=http://your-backend-url:5000
SUPABASE_URL=your_supabase_project_url
SUPABASE_ANON_KEY=your_supabase_anon_key
  1. Start the app
npm start
# or
expo start
  1. Run on device
    • Scan QR code with Expo Go app (iOS/Android)
    • Press i for iOS Simulator
    • Press a for Android Emulator

Backend Setup

  1. Clone the backend repository
git clone https://github.com/Boredoom17/smartcooking-flask-backend.git
cd smartcooking-flask-backend
  1. Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt
  1. Configure environment

    Create a .env file:

FLASK_ENV=development
PORT=5000
SUPABASE_URL=your_supabase_project_url
SUPABASE_KEY=your_supabase_service_key
  1. Run the server
python server.py

The backend will start on http://localhost:5000

πŸ“± Running the App

Development Mode

With Expo Go:

npm start
  • Install Expo Go from App Store (iOS) or Play Store (Android)
  • Scan the QR code to launch the app

Note: Ensure your mobile device and development machine are on the same network.

Testing API Connection

Test if the backend is accessible:

cd smartcooking-flask-backend
python test_api.py

πŸ—‚οΈ Project Structure

SmartCooking/
β”œβ”€β”€ SmartCookingStable/          # Frontend application
β”‚   β”œβ”€β”€ app/                     # App screens
β”‚   β”‚   β”œβ”€β”€ (tabs)/             # Tab navigation
β”‚   β”‚   β”‚   β”œβ”€β”€ index.tsx       # Home/Camera screen
β”‚   β”‚   β”‚   └── history.tsx     # Scan history
β”‚   β”‚   β”œβ”€β”€ auth/               # Authentication screens
β”‚   β”‚   β”œβ”€β”€ recipe/             # Recipe details
β”‚   β”‚   └── _layout.tsx         # Root layout
β”‚   β”œβ”€β”€ components/              # Reusable components
β”‚   β”‚   β”œβ”€β”€ CameraView.tsx
β”‚   β”‚   β”œβ”€β”€ RecipeCard.tsx
β”‚   β”‚   └── IngredientList.tsx
β”‚   β”œβ”€β”€ services/               # API integration
β”‚   β”‚   β”œβ”€β”€ api.ts             # Backend communication
β”‚   β”‚   └── supabase.ts        # Supabase client
β”‚   β”œβ”€β”€ types/                  # TypeScript types
β”‚   β”œβ”€β”€ assets/                 # Images and resources
β”‚   β”œβ”€β”€ app.json               # Expo configuration
β”‚   β”œβ”€β”€ package.json           # Dependencies
β”‚   └── .env                   # Environment config
└── README.md

smartcooking-flask-backend/
β”œβ”€β”€ server.py                   # Flask application
β”œβ”€β”€ test_api.py                # API testing script
β”œβ”€β”€ requirements.txt           # Python dependencies
β”œβ”€β”€ .env                       # Backend configuration
└── test_images/              # Sample test images

🎨 Core Features in Detail

πŸ” User Authentication & Sessions

  • Supabase Authentication - Secure user registration and login
  • Session Management - Persistent user sessions across app restarts
  • User Data Isolation - Each user's scan history stored separately
  • Secure Token Storage - Authentication tokens encrypted locally

πŸ“Έ Ingredient Recognition

  • Powered by YOLOv8n (You Only Look Once v8 Nano)
  • Custom-trained on 13 ingredient categories
  • Recognizes common Nepali and Western cooking ingredients
  • Fast inference time (~200ms average)
  • Bounding box visualization for detected items

Supported Ingredients (13 total): The model is trained to recognize common ingredients like vegetables, fruits that are frequently used in Nepali cuisine.

🎯 Recipe Matching System

  • Percentage-based ranking - Recipes sorted by ingredient match
  • Flexible matching - Shows recipes even with partial ingredient lists
  • Prioritized display - Best matches appear first
  • Recipe database - 30-40 curated recipes (Nepali and Western fusion)

πŸ“œ History Tracking

  • Stores last 10-15 scans per user
  • Quick access to previous ingredient searches
  • View what ingredients were detected in each scan
  • Persistent across app sessions and devices

βš™οΈ Configuration

Adjusting API Endpoint

If running backend on a different device or network:

For local network (device testing):

# Use your computer's local IP
API_URL=http://192.168.1.100:5000

For production deployment:

API_URL=https://your-domain.com

Setting Up Supabase

  1. Create a new project at supabase.com
  2. Create the necessary tables for users, recipes, and scan history
  3. Enable authentication in the Supabase dashboard
  4. Copy your project URL and keys to the .env file

Camera Permissions

The app automatically requests camera permissions on first use. Make sure to allow camera access when prompted.

πŸ“Š Supported Ingredients

The current model supports 13 ingredient categories. This is a demo version with limited ingredient recognition. The model can be expanded with additional training data to support more ingredients.

Note: Ingredient recognition accuracy depends on image quality, lighting conditions, and how clearly ingredients are visible in the photo.

πŸ”’ Privacy & Data

  • Secure Authentication - User credentials managed by Supabase with industry-standard encryption
  • User Data Isolation - Each user's data (scan history, preferences) stored separately
  • No cloud storage of images - Ingredient photos processed in real-time, not stored
  • Local session tokens - Authentication tokens encrypted and stored on device
  • No third-party tracking - No analytics or data sharing with external services

πŸ› Known Limitations

  • Limited to 13 ingredient categories
  • Recognition accuracy varies with lighting and image quality
  • Recipe database is relatively small (30-40 recipes)
  • History limited to last 10-15 scans per user
  • Requires active internet connection for ingredient recognition and authentication

🚧 Current Status

Version: Demo.Final (v0.9.0)

This is a demonstration version developed as a student project. The app showcases core functionality with a limited ingredient database and recipe collection. With additional resources and time, the system can be significantly expanded.

Potential Improvements

  • Expand ingredient recognition to 50+ categories
  • Larger recipe database (100+ recipes)
  • Cloud sync for cross-device history
  • Recipe ratings and favorites
  • Shopping list generation
  • Offline ingredient recognition
  • Nutritional information
  • Dietary preference filters
  • Social features and recipe sharing

🀝 Contributing

This is a student demonstration project. Contributions, suggestions, and feedback are welcome!

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

πŸ“„ License

This project is open source and available under the MIT License.

πŸ‘¨β€πŸ’» Developers

Development Team

Both developers worked collaboratively on the entire project, contributing to both frontend and backend development.

Repositories:

πŸ™ Acknowledgments

  • YOLOv8 by Ultralytics for object detection framework
  • Supabase for providing excellent backend infrastructure
  • React Native and Expo teams for excellent mobile development tools
  • Flask community for lightweight backend framework
  • All testers who provided valuable feedback

πŸ“ž Support

Need help or found a bug?


⭐ Star this repo if you found it helpful!

Made with ❀️ for smarter cooking decisions

πŸ“± Frontend Repo β€’ πŸ”§ Backend Repo β€’ πŸ› Report Bug

Demo Version β€’ Built by Students β€’ Open for Expansion

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors