// blog · Build

Building FoodPal, Part 2: Live on device

From scaffold to phone

In part one, we scaffolded the entire FoodPal app using AI. Kotlin, Jetpack Compose, Room database, sign-up flow, dashboard, and food logging. We couldn't compile it on the stream because this machine runs NixOS and the Android tools don't play nicely with it. So I went offline, ran the Gradle build on another machine that has the Android SDK, and transferred the APK to a phone. Now we're going to look at it together.

The sign-up flow

The first thing the user sees after install is the profile creation screen. I fill in my details: nickname, age, height, weight, lifestyle (moderate), and goal (gain muscle, 5 kilos). The form works. The data goes into the on-device Room database. We're in.

The dashboard

The dashboard is the first real screen, and it does what the prompt asked for. Card one shows calories consumed so far today, with the date at the top. As you add food, that number goes up. Card two shows macros, protein, carbs, and fats, as a bar graph showing how much of each goal you've hit, with the default split of 30% protein, 40% carbs, 30% fats. There's an edit button next to the bar chart that takes you to the macro percentage settings. Card three shows micronutrients, vitamins, sodium, fibre, sugar, written totals against the recommended daily amount, with bars showing progress.

This is all the basic functionality of the mainstream apps. We coded it up in 20 minutes in the last video and here it is, on a phone, working.

Food logging

Hitting the food button takes you to the logging page. At the top there's a date carousel, left and right arrows let you navigate to previous days to view and edit logs. The four meal cards (breakfast, lunch, dinner, snacks) each have the search food button and the custom food button.

The search isn't wired to the hosted Open Food Facts mirror yet. That's coming in part three. But the custom foods feature already works. I go to "My Foods," add a custom food, let's call it "my bread", set the portion (one slice, about 40 grams), enter the calories (100) and protein (3 grams). I save it. It now lives in the list. When I go back to the food page and tap custom foods, there it is. I can add it to breakfast, confirm the amount, and it goes straight into the day's log.

You can do as much or as little of the nutrient info as you like. Not sure about the macros on a random food? Enter what you know. The app accepts partial data and fills in the rest as it gets it.

What's missing: settings

One thing I'm not seeing is a dedicated settings section. The macro editing works. There's an "Edit Macros" button on the dashboard that takes you to the percentage adjustment. But the implied top-level settings menu, where you'd edit your profile, macro goals, and micronutrient targets in one place, isn't there yet. I didn't specifically say "build a settings page" in the prompt. I described the edit buttons in context on each card, and the AI built exactly that. Lesson learned: the AI builds what you describe, not what you imply.

The fix is to add a settings gear icon to the dashboard and expand it into a full settings page. User profile, macro goals, micronutrient targets. I'll add that in the next iteration.

Distribution: F-Droid, not Google Play

Eventually, FoodPal will be on F-Droid. If you're not familiar: F-Droid is an alternative app store for Android. Everything on it is free and open source, verified by a community team before it's published. No Google account required, no Google Play services. You download the app and it updates automatically from the F-Droid server.

The open source guarantee is simple. The code is on GitHub. Anyone can copy it into their preferred AI tool and ask: "Is this tracking me?" The answer will be no. This is an open source app that will never charge for the basic version and never collect your data. If we add sync or backup in the future, and I haven't found a feature that warrants it yet, it'll be opt-in and encrypted end to end.

What comes next

Part three will be database wiring, standing up the hosted Open Food Facts mirror on a private server and connecting the app's search. I'll also add the settings page, exercise calorie logging, and any other features that come out of testing. I'll keep adding features through the series, plug the database in, and publish it.

In the meantime, the code is on GitHub. Watch the repo, try the build, and if you want to test, get in touch. Feedback and criticism are welcome. I'm a team of one, and I love this stuff. There's going to be many more.

FoodPal Android Kotlin Open Code AI Coding
← Back to blog