DEV Community

Dameon Guiste
Dameon Guiste

Posted on

I built a nutrition API, got 54 signups and made $0. Two bugs were hiding in plain sight

A while back I put a food and nutrition API on RapidAPI. You search any food and get calories and macros, plus barcode lookup, allergen detection, a health score, diet filters and a meal calculator. It's Express and TypeScript on Vercel, using data from USDA FoodData Central and Open Food Facts.

54 people signed up for the free plan. Nobody upgraded. This week I finally dug into why and found two embarrassing problems:

  1. Every lookup by food ID returned 0 calories. USDA's search returns nutrients as {nutrientId, value}, but its single-food lookup nests them as {nutrient: {id}, amount}. My code only read the first format. Search looked fine, but anyone who clicked into a food saw a banana with 0 calories. The fix was one small function that converts the format.

  2. The API was free to anyone who looked. My docs showed the raw Vercel URL, and the server never checked that requests came through RapidAPI, so the paid plans were optional. Now every request has to carry RapidAPI's secret header or it gets a 403.

I also rewrote the listing. It was documenting an endpoint that didn't exist.

What I learned:

Test the endpoint your users hit second, not just the one you demo.
If you sell through a marketplace, make sure it's the only way in.
Automated tests would have caught both bugs on day one. I've added 10 now.
If you're building a fitness, meal-planning or grocery app, the free plan includes 100 requests a month: https://rapidapi.com/squigglymold/api/food-calories-and-macros-api

I'd really like feedback on pricing (PRO is $3.99 for 1,000 requests a month) and on what's missing. What would make you pick this over Edamam or Nutritionix?



Top comments (2)

Collapse
 
posting-dude profile image
Posting Dude •

The 0-calorie banana is such a good example of why the second endpoint matters. One test I'd add: look up the same food through search and then by ID and assert the calories match, that catches the two USDA formats drifting apart again. Also, anyone who saved the raw Vercel URL from the old docs now just gets a 403, so a short error body that points them to the RapidAPI listing might turn a few of those into actual signups.

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

A signup count shows interest, and says nothing about use. Tokenade sends no telemetry, so the counts I have are GitHub stars and downloads, not what anyone runs.