Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

FoodVision - AI Food Tracking App

A weight loss and fitness app that uses AI vision to analyze food images, calculate calories, and track your eating habits over time.

Features

  • 📸 Take pictures of your food
  • 🔍 AI-powered food recognition and calorie estimation
  • 🏷️ Automatic food tagging and description
  • 📊 Track your eating habits over time
  • 📱 Mobile-friendly interface

How It Works

  1. Upload a photo of your food
  2. The app uses Llama 4 Maverick vision AI to analyze the image
  3. Get instant feedback on calories, ingredients, and nutritional information
  4. View your eating history and trends over time

Technical Details

  • Backend: TypeScript with Hono framework
  • AI Vision: Llama 4 Maverick via Groq API
  • Database: SQLite for data storage
  • Frontend: HTML, CSS (Tailwind), and JavaScript with HTMX

Project Structure

├── backend/
│   ├── database/
│   │   ├── schema.ts       # Database schema
│   │   └── queries.ts      # Database queries
│   ├── services/
│   │   └── vision.ts       # Groq API integration
│   └── README.md           # Backend documentation
├── frontend/
│   ├── index.html          # Main HTML template
│   ├── app.js              # Frontend logic
│   ├── style.css           # Custom styles
│   ├── favicon.svg         # Favicon
│   └── README.md           # Frontend documentation
├── shared/
│   ├── types.ts            # Shared type definitions
│   └── README.md           # Shared code documentation
└── index.ts                # Main entry point

Getting Started

  1. Visit the app URL
  2. Upload a food image or take a photo
  3. View the AI analysis of your food
  4. Track your progress over time

Environment Variables

To use this app, you'll need to set up one environment variable:

  • GROQ_API_KEY: Your API key for Groq (required for vision analysis)

You can set this in the Val Town environment variables section.

Troubleshooting

If you encounter any issues:

  1. Make sure your GROQ_API_KEY is set correctly
  2. Check that your browser allows camera access if using the photo capture feature
  3. Ensure your image is clear and well-lit for best analysis results