App Misadventures Part 3: The Core

Apps are always a complex item to build out and starting from scratch is both one of the greatest advantages and biggest worry as a developer. On one hand you have absolute control over the project and can bend it to your own style. On the other hand you have nothing no ground work and a long tiring road ahead, is it even worth it?

I have gotten tired of setting up new projects over the past few years, often lacking in direction and no real standout idea to help me drive something that I felt would really go anywhere, inspiration can be a bitch. This time however my aim is to throw myself all in on this one, I have a good problem to solve and one I feel I can create something pretty great using a lot of technologies I've wanted to play with for sometime with some of my core techs making it both new and established for me which does take off some of the edge at least.

Building out the core provides a good chance for me to design it the way I like but of course I must ensure I keep to a good standard, just because it is only me writing this doesn't mean it can be a half arsed job and really I think it provides me excellent practice helping me to keep my skills sharp and allow me to create something pretty awesome as well.

For the core I have centred it around some of the key areas I felt are required currently, aiming to only hit an MVP as I see the scope of this being pretty huge overtime with a lot of potential to add in really nice features, however it is important to keep focus on what is needed just to get something working in a manner that is usable. Luckily I did spend sometime planning early on which has helped me drill down on what was important also talking with my brother a bit I managed to get his perspective which was to be fair fairly close to my own but added a bit more focus around a calendar which I expected was required, didn't think it would be a main focus however.

I decided to use font awesome as I have used their icons for sometime and have the pro package which contains a lot, this provides me with a lot of icons to use across the app and the first place that happened was the navbar. Following the common theme of most electron, if not all, apps I decided to use the left hand navbar basically following the way VS Code does it. I think it is a neat solution and keeps it out of the way enough but provides the required functionality required.

The actual creation of it was not too taxing, fairly systamatic at this point just getting hte icon size correct and width correct took a bit of time. I don't have any pull out from the side yet, it isn't required but it may be eventually we will see, no point in adding it until it is needed though as I am trying to keep this process lean.

I also added in the login page along with Redux and a way to persist the Redux login into local storage. This is a great simple way to keep states between sessions, I aim to move it to pouchDB eventually but that feels a bit further down the road as it doesn't add to my app currently although I think in the long term there will be some nice benefits such as syncing to a remote couchDB which is a pretty solid idea, but baby steps first.

This persisting of the Redux store is pretty nice and handled rather well allowing me to start considering what else can be added into the store as really keeping a slightly bigger store in Electron I don't think would be a problem, although with SQLite on the backend there is questionable need for some of it as it doesn't take long to read from it and push it to the front as they are in the same app. The long term idea would be more to sync the SQLite db to some remote server to allow data to be stored and restored on different systems or even for a web based version, again lots of potential but not for now, not for the current roadmap but hopefully, one day.

Another key element for me was to get the unit testing up and running. I've used mostly Ava before for React, which is a bit of a weird choice but to be fair it was pretty nice, this time I decided to go with the main one which is Jest as it is the widest supported and considering most JavaScript testing libraries are kinda the same I didn't expect it would matter really.

Jest has proven to work fairly well and there is some nice attaching to the process to debug tests which although my setup is a bit clunky it works and can be refined later as I get more confident and knock out the more pressing areas. Either way the addition of Jest has been awesome it has allowed me to really start testing logic and help me get things right with quick(ish) debug cycles which I am very greatful for. Overtime I hope to add in more snapshot testing and intergration tests but I feel these can wait a bit for now but would also love to hook them all up in Github actions which is on the horizon, somewhere...

The backend core is focused around SQLite to give me some persistant, portable storage. It is pretty standard for mobile apps and I feel it works well for this Electron app, as I have limited use with SQLite and am not the biggest database person it has been a bit of a learning curve as I am not using an ORM, my normal choice, at least currently. It works fine currently but will need to keep an eye on it but I think for what I need it should be fine as a lot of the processing will be done outside of this layer because things like data transfer are not really a concern here. Efficiency may become a bigger problem eventually but I think the current setup should be able to handle quite a lot already.

Setting up the core of the application has been rather fun it has allowed me to add in a lot of the key features needed that will be built out over the course of this app creation. I think it is a strong enough core that it should cope with a lot and the idea is going to be to scale up parts of it gradually such as adding in PouchDB and switching verious solutions later down the road, my first goal is achieving a working app that does the core feature, after that it will be looking at what comes next and I expect most of that will come from feedback.

There is a long road ahead, it is coming along pretty well given the limited amount of time I've spent on the app so I am very confident I can get a working MVP before the end of the year, as this is my goal.

Photo by Kalen Emsley on Unsplash