food-tracker
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.
Viewing readonly version of main branch: v5View latest version
A web-based food calorie tracker that estimates calories using AI and logs them to Notion.
- 🍎 Web interface for entering food descriptions
- 🤖 AI-powered calorie estimation using OpenAI GPT-4o
- 📊 Automatic logging to Notion database
- 🎨 Clean, responsive UI with TailwindCSS
Set these environment variables in your Val Town account:
NOTION_OAUTH_TOKEN
- Your Notion OAuth tokenOPENAI_API_KEY
- Your OpenAI API key (handled by Val Town's OpenAI integration)
Your Notion database should have these properties:
- Name (Title) - Food name
- Calories (Number) - Calorie count
- Date (Date) - Entry date (auto-populated)
Update the notionFoodDbId
in notion.ts
with your database ID.
- Visit the HTTP endpoint URL for your Val Town
- Enter a food description (e.g., "RT Rotisserie bowl with chicken and beet tahini sauce")
- Click "Estimate Calories & Log"
- View the AI's calorie estimate and confirmation of Notion logging
main.http.ts
- HTTP trigger with web interface and AI integrationnotion.ts
- Notion API integration for logging food entries- Uses Val Town's OpenAI integration for GPT-4o access
- Responsive web UI built with TailwindCSS
This version has been migrated from a Bun CLI script to a Val Town HTTP trigger:
- ✅ Uses Val Town's OpenAI integration instead of direct OpenAI SDK
- ✅ Environment variables use
Deno.env.get()
instead ofprocess.env
- ✅ ESM imports from
https://esm.sh
for compatibility - ✅ Web interface instead of CLI
- ✅ HTTP trigger following Val Town conventions