Beginner 2-3 hours · 2 APIs

Build a Recipe Nutrition Checker

Search for recipes and instantly see detailed nutritional information. Perfect for health-conscious meal planning.

APIs Used

Data Flow

USER User searches for a recipe by keyword API Search matching recipes via Edamam Recipe USER User selects a recipe from results API Fetch nutritional breakdown for ingredients via Edamam Nutrition OUTPUT Display calories, macros, and dietary labels
User Action
API Call
Transform
Output

How It Works

1

Search for recipes by keyword using Edamam Recipe API

2

Display matching recipes with images and ingredient lists

3

When user selects a recipe, send its ingredients to Nutrition API

4

Show calories, macronutrients, and dietary labels

Code Outline

Pseudocode / JavaScript
// 1. Search for recipes
const recipeRes = await fetch(
  'https://api.edamam.com/api/recipes/v2?type=public&q=chicken+salad&app_id=YOUR_APP_ID&app_key=YOUR_API_KEY'
);
const { hits } = await recipeRes.json();
const recipe = hits[0].recipe;

// 2. Get nutrition for the recipe ingredients
const nutritionRes = await fetch(
  'https://api.edamam.com/api/nutrition-details?app_id=YOUR_APP_ID&app_key=YOUR_API_KEY',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ ingr: recipe.ingredientLines })
  }
);
const nutrition = await nutritionRes.json();

// 3. Display results
console.log(`Recipe: ${recipe.label}`);
console.log(`Calories: ${Math.round(nutrition.calories)}`);
console.log(`Protein: ${Math.round(nutrition.totalNutrients.PROCNT.quantity)}g`);
console.log(`Fat: ${Math.round(nutrition.totalNutrients.FAT.quantity)}g`);
console.log(`Carbs: ${Math.round(nutrition.totalNutrients.CHOCDF.quantity)}g`);

Recipe Details

Difficulty Beginner
Time 2-3 hours
APIs Used 2

Note: These recipes are AI-generated suggestions based on API capabilities. Actual implementation may vary. Always refer to official API documentation for the latest specifications.