A few weeks ago I wanted a simple answer: how much protein is in 100 g of cooked lentils? The top results were slow, covered in ads, or hid the numbers behind an app download. The data itself is public. The USDA publishes lab-measured nutrition values for thousands of foods for free.
So I built Nutrinfo : one fast page per food, generated straight from USDA data, plus a few calculators and an AI meal analyzer. This post covers how it is put together, with the real code.
The stack
Astro for static generation, with output: 'static'
Cloudflare Pages for hosting, with one Pages Function for the AI endpoint
GitHub Actions to build and deploy on every push to main
USDA FoodData Central, SR Legacy as the data source (7,793 foods, up to 150 nutrients each)
No database and no server. Every food page is plain HTML on Cloudflare's edge.
Step 1: turning a 200 MB JSON file into site data
USDA ships SR Legacy as one large JSON file.…