Skip to content
VercelLogotypeVercelLogotype
LoginSign Up

Caltext

iMessage calorie tracking assistant, powered by AI.

DeployView Demo

Caltext

iMessage calorie tracking assistant powered by AI.

Stack

  • Runtime: Bun + Turborepo monorepo
  • API: Hono on Nitro (deployed to Vercel, 3 regions)
  • iMessage: Chat SDK + Sendblue adapter
  • AI: AI SDK v6 + GPT-4.1 (vision + agent)
  • Database: Upstash Redis (global, 3 regions)
  • Workflows: Vercel Workflow SDK for durable pipelines
  • Nutrition: USDA FoodData Central API

Setup

1. Install dependencies

bun install

2. Configure environment

cp .env.example .env

Fill in the required keys:

VariableSource
SENDBLUE_API_KEY / SENDBLUE_API_SECRETsendblue.co
SENDBLUE_FROM_NUMBERYour Sendblue phone number
UPSTASH_REDIS_REST_URL / UPSTASH_REDIS_REST_TOKENconsole.upstash.com
REDIS_URLSame Upstash Redis in redis:// format
OPENAI_API_KEYplatform.openai.com
USDA_API_KEYfdc.nal.usda.gov (free)

3. Run locally

bun run dev

4. Deploy to Vercel

vercel deploy

Deploys to 3 regions: US East (iad1), London (lhr1), Tokyo (hnd1).

5. Set Sendblue webhook

Point your Sendblue incoming message webhook to:

https://your-app.vercel.app/webhooks/sendblue

Project Structure

caltext/
apps/
api/ # Hono API server
src/
index.ts # Routes + webhook handler
bot.ts # Chat SDK singleton
router.ts # Onboarding vs assistant routing
workflows/
handle-message.ts # Main message handler
onboarding.ts # Multi-step onboarding
reminder-loop.ts # Daily reminders + summaries
packages/
ai/ # AI agent + tools
db/ # Upstash Redis data layer
shared/ # Types, locale, timezone utils

How It Works

  1. User texts the Caltext number via iMessage
  2. Sendblue forwards the message via webhook
  3. New users go through conversational onboarding (name, stats, goal)
  4. Returning users interact with the AI assistant
  5. Photos are analyzed with GPT-4.1 vision, then grounded in USDA nutrition data
  6. Text descriptions are matched against USDA database directly
  7. Daily reminders at breakfast/lunch/dinner times (timezone-aware)
  8. End-of-day summaries with calorie/macro breakdown
  9. Weekly recaps with progress bars and trends
GitHub Repopontusab/caltext
Use Cases
AI
Stack
Hono
Nitro
Database
Upstash

Related Templates

Next.js Boilerplate

Get started with Next.js and React in seconds.
Next.js Boilerplate thumbnail

Image Gallery Starter

An image gallery built on Next.js and Vercel Blob.
Image Gallery Starter thumbnail

Chatbot

A full-featured, hackable Next.js AI chatbot built by Vercel
Chatbot thumbnail

Get Started

  • Templates
  • Supported frameworks
  • Marketplace
  • Domains

Build

  • Next.js on Vercel
  • Turborepo
  • v0

Scale

  • Content delivery network
  • Fluid compute
  • CI/CD
  • Observability
  • AI GatewayNew
  • Vercel AgentNew

Secure

  • Platform security
  • Web Application Firewall
  • Bot management
  • BotID
  • SandboxNew

Resources

  • Pricing
  • Customers
  • Enterprise
  • Articles
  • Startups
  • Solution partners

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base
  • Academy
  • Community

Frameworks

  • Next.js
  • Nuxt
  • Svelte
  • Nitro
  • Turbo

SDKs

  • AI SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDK
  • Streamdown AINew

Use Cases

  • Composable commerce
  • Multi-tenant platforms
  • Web apps
  • Marketing sites
  • Platform engineers
  • Design engineers

Company

  • About
  • Careers
  • Help
  • Press
  • Legal
  • Privacy Policy

Community

  • Open source program
  • Events
  • Shipped on Vercel
  • GitHub
  • LinkedIn
  • X
  • YouTube

Loading status…

Select a display theme:
    • AI Cloud
      • AI Gateway

        One endpoint, all your models

      • Sandbox

        Isolated, safe code execution

      • Vercel Agent

        An agent that knows your stack

      • AI SDK

        The AI Toolkit for TypeScript

      • v0

        Build applications with AI

    • Core Platform
      • CI/CD

        Helping teams ship 6× faster

      • Content Delivery

        Fast, scalable, and reliable

      • Fluid Compute

        Servers, in serverless form

      • Workflow

        Long-running workflows at scale

      • Observability

        Trace every step

    • Security
      • Bot Management

        Scalable bot protection

      • BotID

        Invisible CAPTCHA

      • Platform Security

        DDoS Protection, Firewall

      • Web Application Firewall

        Granular, custom protection

    • Company
      • Customers

        Trusted by the best teams

      • Blog

        The latest posts and changes

      • Changelog

        See what shipped

      • Press

        Read the latest news

      • Events

        Join us at an event

    • Learn
      • Docs

        Vercel documentation

      • Academy

        Linear courses to level up

      • Knowledge Base

        Find help quickly

      • Community

        Join the conversation

    • Open Source
      • Next.js

        The native Next.js platform

      • Nuxt

        The progressive web framework

      • Svelte

        The web’s efficient UI framework

      • Turborepo

        Speed with Enterprise scale

    • Use Cases
      • AI Apps

        Deploy at the speed of AI

      • Composable Commerce

        Power storefronts that convert

      • Marketing Sites

        Launch campaigns fast

      • Multi-tenant Platforms

        Scale apps with one codebase

      • Web Apps

        Ship features, not infrastructure

    • Tools
      • Marketplace

        Extend and automate workflows

      • Templates

        Jumpstart app development

      • Partner Finder

        Get help from solution partners

    • Users
      • Platform Engineers

        Automate away repetition

      • Design Engineers

        Deploy for every idea

  • Enterprise
  • Pricing
Log InContact
Sign Up
Sign Up
ContactDashboard
DeployView Demo
AI Gateway

One endpoint, all your models

Sandbox

Isolated, safe code execution

Vercel Agent

An agent that knows your stack

AI SDK

The AI Toolkit for TypeScript

v0

Build applications with AI

CI/CD

Helping teams ship 6× faster

Content Delivery

Fast, scalable, and reliable

Fluid Compute

Servers, in serverless form

Workflow

Long-running workflows at scale

Observability

Trace every step

Bot Management

Scalable bot protection

BotID

Invisible CAPTCHA

Platform Security

DDoS Protection, Firewall

Web Application Firewall

Granular, custom protection

Customers

Trusted by the best teams

Blog

The latest posts and changes

Changelog

See what shipped

Press

Read the latest news

Events

Join us at an event

Docs

Vercel documentation

Academy

Linear courses to level up

Knowledge Base

Find help quickly

Community

Join the conversation

Next.js

The native Next.js platform

Nuxt

The progressive web framework

Svelte

The web’s efficient UI framework

Turborepo

Speed with Enterprise scale

AI Apps

Deploy at the speed of AI

Composable Commerce

Power storefronts that convert

Marketing Sites

Launch campaigns fast

Multi-tenant Platforms

Scale apps with one codebase

Web Apps

Ship features, not infrastructure

Marketplace

Extend and automate workflows

Templates

Jumpstart app development

Partner Finder

Get help from solution partners

Platform Engineers

Automate away repetition

Design Engineers

Deploy for every idea