This past week, I had the thought that I’d really like for the win/receipts app I started to have a Rails backend rather than a Supabase backend. I know that Supabase has edge functions that could support some backend logic, but I just feel like I’d rather start with a robust backend I’m familiar with. That way, I can add more features, services, and model logic without needing to stuff everything into the frontend (and blow up its size) or into Supabase edge functions—which I suspect weren’t designed to handle what a Rails backend can.
I’d still like to test out Supabase more and explore its limitations, but not with this project.
To keep things simple and leverage an AI coding assistant (Augment Code), I realized I could create a folder that contains the existing React app for receipts, and then ask Augment—inside this higher-level folder—to build a Rails API that could replace Supabase. This would let me build API endpoints on the Rails side and client interfaces on the React side to replace the Supabase client interfaces.
…And it did!


I had to do a few back-and-forths to get it to work, but it was a lot simpler than doing it myself, especially since I was having trouble getting JWT to work on my own on a past side project.
I was even able to get Augment to explain how the whole authentication process worked, even down to walking through a simplified version of what has_secure_password
does internally. And now I understand it all better, and can apply this knowledge to future projects! This is a big part of why I’m doing these projects, anyway.
A few days later, I wondered if Augment could build a working React Native application, so that I could take that apart and see how that worked, too. I asked it to create one in the same high-level folder, and connect it to the Rails API. It took some troubleshooting and some time to get my local environment ready to run an Android emulator in order to test the application. Eventually, I was able to log in and pull in some of the data!

After I got it working initially, there was some debugging to do. For example, in order to show wins related to a given habit, goal, or value, the react-native client was looking for wins to have an array of associated habit_ids, value_ids, and goal_ids.

The Rails API side didn’t present wins that way.


So I informed Augment and gave him some direction (my Code Assistant is instructed to behave like Alfred from Batman), and he quickly fixed it so that the API’s win index endpoint now includes the related habits, goals, and values:

And now showing related wins works!

It was really exciting to very quickly build a Rails API backend and connect it to both a react AND react-native front end (also very quickly built). I’ve learned so much along the way, just by digging into the working code, and I’m excited to further unpack the code and better understand how these frameworks operate so that I can build even more effectively.
In the coming weeks, I’d like to get the Rails API hosted on something like heroku, and be able to point the React and React-Native front ends to it, so that I can use the app on my phone more regularly, and figure out what other features I’d like to add to it for what I’d consider an MVP for launch.
See you in a bit!
Leave a Reply