The Server-side JavaScript runtime

I’m back, after a short break and much swearing at third party libraries. I was going to use React.NET as that bundles up all the things required, but it has too many opinions about how you call your React components. Since I’m using Redux and react-router this makes most of the code redundant, so I went back to using the raw components.

Additionally, I switched from V8 to using Microsoft’s Chakra runtime because the existing V8 interop libraries do not support .NET Core yet. I’m using JavaScriptEngineSwitcher so it’s not hard to change out the engine later.

read more…

The Web UI

Time for the web UI! I’m building this using ASP.NET 5 and ASP.NET MVC 6 for the controller side and React, Redux, Immutable and TypeScript for the view layer. I’m not a fan of node.js, but I do like the web view being defined in one place so running React on the server side appeals to me. I could run it fully in the browser but servers tend to be faster than clients, especially mobile clients.

I’m using React and Redux because they work well with how I like to think about my applications. User actions trigger state changes which then cause a re-render. Having a single state object makes it much easier to figure out what causes problems, and it reduces the overall complexity of the application.

Immutable is just used for confidence that the Redux action-reducer-props pattern is followed without accidentally mutating state. I’ve seen other technology like freezer used for this, but freezer is more of a full replacement for Redux.

read more…

Api controllers

The backend Api servers are going to use the WebAPI component of ASP.NET 5 to make a RESTful api. Since I’m using entity framework for the database layer this is a remarkably simple piece of code, especially since most of it will be automatically generated.

Right now I’ll focus on the basic create/read/update/delete (CRUD) methods, later on I’ll get to some more interesting logic when it’s time for automatic transaction posting and budget forecasting.

As last time I’ll just show one class, since right now they’re almost identical. I’ll post snippets when I use more features later on, but right now I want to get enough backend code completed to start on the UI layer.

read more…

Models and entities oh my

I promised code, so it’s time to get coding! I’m going to start with the api server, then implement the UI on top of that.

The backend is going to be built using ASP.NET 5 and WebAPI for the web layer. The database is going to be sqlite and I’ll be using Entity Framework 7 for the database access layer. These choices are mostly because they’re the defaults in ASP.NET, but I don’t have much experience with Entity Framework so it’s a great opportunity to learn.

I’ll be using Visual Studio 2015 community edition, but since the ASP.NET 5 projects don’t require MSBuild this could easily be Visual Studio Code on Mac or Linux. You’ll need the ASP.NET Release Candidate or a later version.

read more…

Planning the finance app

I don’t like deciding too much up front, but understanding what you’re trying to do helps. I tend to focus more on the logic side rather than the UI - since I’m not that great at UI work - so I’ll start from the data model and work up.

What I want out of this

To figure out the data model I need to figure out what I want out of this. The two biggest parts are setting a budget and seeing how well actual spending compares to that budget. In the future I’d like to do things like analyse spending patterns and maybe intelligently inform the budget, but that’s a later goal.

I also want to have some implementation of shared accounts. Since I don’t have a joint account with my wife we transfer money between our individual accounts a lot. It’d be nice to be able to have a virtual spending account to track all this. I have ideas on how to implement this with the architecture from the first post, but that’s for another time.

I’m also going to defer repeating transactions. They’re useful from a budget point of view, but they don’t need to be there from day one.

read more…