Short history of Makro.diet part 1

Sept. 2, 2017, 9:57 a.m.

My latest project was a calorie counter / meal planner. Technically this was the latest but since I didn't have to do much for this I don't count it as a full project. For the calorie counter (later referred as Makro) I used MongoDB as the database, Node + Express as the server and Vue for front end. So far I've been happy with the decision.

When I started planning for Makro I thought about using PostgreSQL as the database (this was before I made my first full stack app, Videoknight). But I ended up using MongoDB since the data that I was importing to the database was in JSON format already and Mongo ate that nicely so I went with it. Setting up the database was simple enough. In the beginning I had only two collections; one for the user data and second one for the foods. Later on I've added two more: one for when the users want to save their planned their day and one for feedbacks.

When it comes to back end I really had no idea which language and technology to choose. I tried out both PHP and Python but in the end I decided to go with JavaScript so Node + Express. Haven't had any regrets so far. I enjoy using JavaScript (probably because that's the language I have used the most) and Node seems a solid choice for server.

I had some trouble choosing a JavaScript framework for front end as well. First I looked at React and it seemed good enough and I was most likely going to choose it but I wanted to try out Angular, too. Angular felt really heavy and clunky and seemed to have a quite steep learning curve so I ditched that for this project. I just wanted to get it done sooner rather than later. But before I started with React I ran into Vue.js. It seemed cool, light and easy to learn so I gave it a shot as well. And it really clicked. I liked it immediately. This was the framework I was gonna use. But before I started working on Makro I had to try these technologies first. I wanted everything to go smoothly with Makro. It was going to be my pet project.

First I wanted to try out Vue and made my IMDb voting history website with it and I made a RESTful API for it to use with Node + Express. It was nothing too complicated and seemed like a good way to get started with this stack. After I was done with that I wanted to make portfolio v2 with just Vue to get a little more experience with it before starting Makro. And when that was ready it was time to start. But not with Makro though. I had gotten an idea for a self-playing game which came to known as Videoknight.

First I made the front end which was rather simple. There wasn't that many things to do. I found a package for getting YouTube videos which made it really easy to listen to when the video that was playing ends and so on. Then it was time to get working on backend and database. I wanted this game to have a possibility to save progress so you could continue playing and leveling up anytime you wanted. The only way to do that properly was to register user and save their data to database. I think I had some minor problems while doing this project but I can't recall what they were. The biggest time sink with Videoknight was finding the channels where it pulls the videos for the game. I had to look for channels that had at least 50 videos since I wanted to use YouTube API in a way that it gets the 50 most recent videos uploaded to that channel. I wanted to avoid errors of channel not having 50 videos.

I set up channel IDs to arrays of 12 (because entering more to array made my editor bug and not highlightin syntax) and there is around 15 of them. So quite a lot of videos. I learned a lot during that project about saving data to database, setting up user registration, login and stuff like that. Now I was ready to tackle the biggest challenge so far. Making my own calorie counter. But more on that later on.


  • No comments. :(