·5 min read

I built an application using the TACO Nutrition Table

#programação#reflexão#nutrição

It all started on a Thursday afternoon. When I got back from the gym and found myself wondering what I could eat, I didn’t do what most people would do—open ChatGPT and ask what to eat post-workout.

No, I had the idea to turn this into something more. I started developing and initially faced some issues regarding data quality. I couldn’t find a reliable source, and I didn’t even know what to search for. Up until then, I had no knowledge of the Brazilian Food Composition Table – TACO.

Preparing the Data

I downloaded the .csv file and normalized it using Python with Google Colab. It was completely messy when I first downloaded it and tried to use it brute-force. Definitely, normalizing it was the best decision to avoid future problems.

For better understanding of how I prepared the file before using it as a database source and populating the tables, here is the file:

Taco Table

Defining the Stack and Preparing the Environment

When I started developing the project, I thought about using Go to become more familiar with the language and continue improving. But in the end, I decided to stick with the Node.js ecosystem.

npm init --y 
npm i typescript @types/node tsx -D

Then, I added the normalized file to the root of the project, defined the schema in Prisma, created the tables, and populated them with the data from the TACO file.

npm i @prisma/client
npm i prisma -D

Done, I had the ideal environment ready to use. Now that all the necessary data was inside the database, I moved on to developing the project’s API. For personal preference, I chose to use Fastify.

npm i fastify

Developing the API

After a few hours configuring the entire API, validations with Zod, and authentication, I had a functional API that provided updated and documented nutritional values—everything to make building my diet easier. Do I regret not asking ChatGPT what to eat? Yes, but it was fun developing while listening to good music. Overall, it turned out very intuitive to test and use for building applications in the health niche.

API Documentation

Developing the Website – Home Page

The development of the website was smooth. But since my initial idea was to build a functional API for third parties, I didn’t have a clear idea of what to create.

So I asked some AI tools for suggestions and adopted the ones I found most interesting for the project. I started by adding a main table displaying the nutritional values of each food item individually. Later on, I added the Zustand library:

npm i zustand

To manage the state of favorited items, which would be used on a subsequent screen.

Website Development – Calculator

The main idea of this screen is to have nutritional data readily available for automated diet calculations. It allows visualization of protein, calories, carbohydrates, sodium, and other nutritional and informational data. I shared this application with some nutritionist friends, and they really liked the idea.

Additionally, it’s possible to save the diet as a PDF, making it even easier to share with a patient, for example.

See an example by clicking here

Website Development – Comparator

The idea behind this page was inspired by the nutritional calculator page. What differs is the purpose: this screen aims to inform users about the pros and cons of each meal.

The user selects the foods to compare, and the system fetches the information and simplifies the comparison, indicating which one has more of each nutrient.

Website Development – Label Generator

Here, I went a step further. I thought about something that could solve a common problem for independent entrepreneurs: adding nutritional information to meals. For example, suppose you run a fitness meal prep business—your customers likely want to know what they’re consuming. For non-nutritionists, this process can be time-consuming or even costly.

So I decided to integrate and provide this tool that allows users to generate labels and download them. The end user can simply print and attach them to the meals.

Generated Label Example

Website Development – AI Assistant

The project was already polished and working smoothly. But I decided to add an AI Assistant to further improve the user experience. Unlike ChatGPT, this model consumes data directly from the TACO table.

All foods selected from the AI suggestions are sent directly to the Calculator, where you can make the necessary adjustments.

Developer Documentation

The API documentation is available at the link. It is integrated with Swagger, so you only need an API Key on the platform and on RapidAPI if you want to integrate it into your project. Welcome!

Donation

To keep the service running, I’m monetizing through donations. Don’t feel obligated to contribute—only if you like the product and the idea.

Donate

Final Thoughts

The last screens of the application are focused on developers. I’ve been tracking API usage, and it has been receiving significant traction, with products already consuming the API directly and people using the platform for various purposes.

That’s all.

Goku ending 3 | Anime dragon ball super, Anime dragon ball, Dragon ball ...