Integration Blueprints

Build an AI Calorie Tracker in 15 Minutes

Copy and paste working, production-ready integration boilerplates for Flutter, Next.js, SwiftUI, and Python with the FoodVivo REST API pre-configured.

200 Free API Requests Included•Camera & Barcode Ready•Zero Package Overhead
FlutterMobile App (iOS & Android)

Flutter AI Calorie & Meal Scanner

Complete mobile integration service with camera plate scanning, barcode lookup, local caching, and real-time macro decomposition.

Included Capabilities
  • Camera photo upload to POST /v1/food/analyze
  • UPC/EAN barcode scanning with direct GTIN resolution
  • Dynamic macro breakdown charts (Protein/Carb/Fat)
  • Offline cache with optimistic UI updates
  • Zero third-party SDK dependencies (Pure HTTP)
lib/services/foodvivo_service.dart
import 'package:http/http.dart' as http;
import 'dart:convert';

class FoodVivoService {
  final String apiKey;
  static const String baseUrl = 'https://foodvivo-api.flappybird-assets.workers.dev';

  FoodVivoService({required this.apiKey});

  Future<Map<String, dynamic>> scanMealPhoto(String base64Image) async {
    final res = await http.post(
      Uri.parse('$baseUrl/v1/food/analyze'),
      headers: {
        'Authorization': 'Bearer $apiKey',
        'Content-Type': 'application/json',
      },
      body: jsonEncode({
        'image': base64Image,
        'enable_449_check': true,
      }),
    );
    final json = jsonDecode(res.body);
    return json['data'];
  }
}
Next.jsWeb Application

Next.js 15 Full-Stack Meal Logger

Production-ready Next.js 15 App Router action with Tailwind CSS, Drag-and-Drop photo upload, and instant calorie breakdown cards.

Included Capabilities
  • Next.js 15 App Router & Server Actions
  • Drag-and-Drop image dropzone with instant client preview
  • Natural language meal bar (e.g. '2 eggs + 1 roti')
  • Sub-18ms Edge Anycast cached responses
  • Standard Web Fetch API (No extra libraries)
app/actions/analyze.ts
"use server";

export async function analyzeMealAction(query: string) {
  const res = await fetch("https://foodvivo-api.flappybird-assets.workers.dev/v1/food/analyze", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.FOODVIVO_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      text: query,
      context: "Meal Log",
    }),
  });

  const { data } = await res.json();
  return data;
}
SwiftUINative iOS

SwiftUI iOS Native Food Scanner

High-performance native iOS client built with SwiftUI, URLSession async/await networking, and Apple HealthKit integration.

Included Capabilities
  • Native AVCaptureSession camera preview integration
  • Apple HealthKit daily calorie & macro write permissions
  • Swift concurrency (async/await) networking
  • Instant haptic feedback on verified food recognition
  • Pure URLSession REST API (Zero external packages)
Services/NutritionClient.swift
import Foundation

actor NutritionClient {
    private let apiKey: String
    private let endpoint = URL(string: "https://foodvivo-api.flappybird-assets.workers.dev/v1/food/analyze")!

    init(apiKey: String) {
        self.apiKey = apiKey
    }

    func analyzePhoto(imageData: Data) async throws -> [String: Any] {
        var request = URLRequest(url: endpoint)
        request.httpMethod = "POST"
        request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        request.httpBody = try JSONSerialization.data(withJSONObject: [
            "image": imageData.base64EncodedString()
        ])

        let (data, _) = try await URLSession.shared.data(for: request)
        return try JSONSerialization.jsonObject(with: data) as? [String: Any] ?? [:]
    }
}
PythonBackend Microservice

Python & FastAPI Diet Intelligence Service

FastAPI integration service for coaching platforms and clinics. Performs batch meal analysis, allergen alerts (Big-9), and patient compliance scoring.

Included Capabilities
  • Asynchronous httpx FoodVivo client
  • FDA Big-9 allergen detection & safety flags
  • Daily multi-meal aggregator with macro balance
  • Automated nutrition data normalization
  • Clean async REST client
app/services/nutrition.py
import httpx
import os

API_KEY = os.getenv("FOODVIVO_API_KEY")
BASE_URL = "https://foodvivo-api.flappybird-assets.workers.dev"

async def analyze_patient_meal(meal_text: str):
    async with httpx.AsyncClient() as client:
        res = await client.post(
            f"{BASE_URL}/v1/food/analyze",
            headers={"Authorization": f"Bearer {API_KEY}"},
            json={"text": meal_text, "enable_449_check": True}
        )
        return res.json()["data"]