FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
tanishqkancharla
tanishqkancharlafood-tracker
Public
Like
food-tracker
Home
Code
10
scripts
1
.vtignore
AGENTS.md
README.md
deno.json
H
main.http.ts
notion.ts
test_server.ts
test_usda.ts
usda.ts
Branches
1
Pull requests
Remixes
History
Environment variables
5
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.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
README.md

Food Calorie Tracker - Val Town Version

A web-based food calorie tracker that estimates calories using AI and logs them to Notion.

Features

  • 🍎 Web interface for entering food descriptions
  • 🤖 AI-powered calorie estimation using OpenAI GPT-4o
  • 📊 Automatic logging to Notion database
  • 🎨 Clean, responsive UI with TailwindCSS

Setup

Environment Variables

Set these environment variables in your Val Town account:

  • NOTION_OAUTH_TOKEN - Your Notion OAuth token
  • OPENAI_API_KEY - Your OpenAI API key (handled by Val Town's OpenAI integration)

Notion Database

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.

Usage

  1. Visit the HTTP endpoint URL for your Val Town
  2. Enter a food description (e.g., "RT Rotisserie bowl with chicken and beet tahini sauce")
  3. Click "Estimate Calories & Log"
  4. View the AI's calorie estimate and confirmation of Notion logging

Architecture

  • main.http.ts - HTTP trigger with web interface and AI integration
  • notion.ts - Notion API integration for logging food entries
  • Uses Val Town's OpenAI integration for GPT-4o access
  • Responsive web UI built with TailwindCSS

Migration from Original

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 of process.env
  • ✅ ESM imports from https://esm.sh for compatibility
  • ✅ Web interface instead of CLI
  • ✅ HTTP trigger following Val Town conventions
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.