Caltext is an open-source AI assistant template for building an iMessage calorie-tracking bot that accepts plain text and photos, logs nutrition via USDA data, and sends automated reminders and summaries through Sendblue.
What is Caltext?
Caltext is a production-ready starter for an AI-powered nutrition tracking assistant accessed entirely through iMessage. It takes a user's incoming text messages and photos as input, processes them with GPT-4.1 vision and the AI SDK v6, and returns structured calorie and macro logging, daily summaries, and weekly recaps through Sendblue. The codebase is a Bun + Turborepo monorepo with a Hono API on Nitro deployed to Vercel across three regions (US East, London, Tokyo), using Upstash Redis for global state.
Key Features
- Conversational onboarding — New users are guided through a multi-step flow that collects their name, body stats, and weight goal before any food logging begins, all within the iMessage thread.
- Photo-based food logging — Users send a photo of a meal; GPT-4.1 vision identifies the food and grounds the result in USDA FoodData Central nutrition data rather than an unverified database.
- Text-based food matching — Plain text meal descriptions are matched directly against the USDA database with no photo required.
- Timezone-aware daily reminders — The reminder loop schedules breakfast, lunch, and dinner check-ins and adapts to each user's locale and timezone from shared utilities.
- End-of-day summaries — A workflow produces a calorie and macro breakdown every evening, and a separate weekly recap includes progress bars and trend lines.
- Durable workflows — The Vercel Workflow SDK powers handle-message, onboarding, and reminder-loop pipelines that survive failures and retries.
- Multi-region deployment — The Hono API is configured for three Vercel regions (iad1, lhr1, hnd1) with Upstash Redis, so user state is globally replicated.
- Modular monorepo — The repository separates
apps/api(routes, webhook handler, bot singleton, router) frompackages/ai,packages/db, andpackages/sharedfor clean reusability.
Who is it for?
Caltext is for developers who want to ship a conversational health assistant without building the iMessage integration, nutrition data pipeline, and reminder infrastructure from scratch. It suits developers comfortable with Bun, TypeScript, Hono, and Vercel, and teams that need a reference implementation for AI-powered food logging with real USDA nutrition data. Product builders can fork it to create custom dietitian, wellness, or habit-tracking bots with the same message-driven flow.
What can you do with Caltext?
- Track meals by sending photos — Text a plate to the Caltext number and receive a logged entry with calories and macros, grounded in USDA data via GPT-4.1 vision.
- Log food from text descriptions — Type a meal like "chicken salad with vinaigrette" and get a matched USDA nutrition result without opening an app.
- Receive automatic check-ins — Get breakfast, lunch, and dinner reminders timed to your timezone, plus an end-of-day calorie and macro summary and a weekly progress recap.
- Build your own iMessage bot — Use the tested webhook route, onboarding state machine, and reminder loops as the base for any AI assistant that communicates solely over iMessage.
How does Caltext work?
A user texts the Caltext iMessage number; Sendblue forwards the incoming message to the webhook endpoint in the Hono API. The router decides whether the user is new (starting conversational onboarding) or returning (forwarding to the AI assistant). For photo messages, GPT-4.1 vision extracts food items and the assistant looks up nutrition from USDA FoodData Central; for text, it queries the same USDA data directly. Logged entries are stored in Upstash Redis, and the reminder loop triggers daily summaries and weekly recaps via Sendblue.








