Beginner 2-3 hours · 3 APIs

Build a Food Explorer

Discover recipes, get nutrition facts, and see beautiful food photos all in one place. A one-stop culinary exploration tool.

APIs Used

Data Flow

USER User searches for a food item API Search matching recipes via Edamam Recipe API Get nutrition data for main ingredient via Nutritionix API Fetch a food photo via Unsplash OUTPUT Display combined food exploration card
User Action
API Call
Transform
Output

How It Works

1

User searches for a food item or ingredient

2

Fetch matching recipes from Edamam

3

Get nutrition data from Nutritionix for the main ingredient

4

Fetch a beautiful food photo from Unsplash

5

Display everything in a combined food exploration card

Code Outline

Pseudocode / JavaScript
// 1. Search for recipes
const recipeRes = await fetch(
  'https://api.edamam.com/api/recipes/v2?type=public&q=pasta&app_id=YOUR_ID&app_key=YOUR_KEY'
);
const { hits } = await recipeRes.json();

// 2. Get nutrition for the main ingredient
const nutritionRes = await fetch('https://trackapi.nutritionix.com/v2/natural/nutrients', {
  method: 'POST',
  headers: { 'x-app-id': 'YOUR_ID', 'x-app-key': 'YOUR_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({ query: 'pasta 100g' })
});
const { foods } = await nutritionRes.json();

// 3. Get a food photo
const photoRes = await fetch(
  'https://api.unsplash.com/photos/random?query=pasta+food',
  { headers: { 'Authorization': 'Client-ID YOUR_UNSPLASH_KEY' } }
);
const photo = await photoRes.json();

// 4. Display combined results
console.log(`Top Recipe: ${hits[0].recipe.label}`);
console.log(`Calories (100g pasta): ${foods[0].nf_calories}`);
console.log(`Food photo: ${photo.urls.regular}`);

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.