---

layout:     post
title:      "mintwise"
slug:       "mintwise"
date:       2020-06-08 12:05:00
categories: projects

---

[![mintwise logo](/images/mintwise_logo.svg)][mintwise]

So imagine this scenario: you move in with your partner and you want to start splitting rent, utilities, groceries, dining out, vacation expenses, home goods expenses, etc. "Don't worry," you say, "there's an app for that, [Splitwise]!"

Great! Now all you have to do is comb through all of your credit card expenses at the end of the month and put them in Splitwise... and put the right date... and the right category...

"No problem," you say, "I'll just put in the expenses into the Splitwise app as I pay for them." Well, except you forget to put a few expenses in at the time you're purchasing them. Now it's the end of the month, and you're still going through your credit card statement _and_ deduping the ones you've already put in.

"There has to be a better way," you say, "I know! I'm a software engineer. If there's anything I'm good at, it's over engineering a solution to a minor annoyance!"

Enter **[mintwise]**, a command line interface to pull the transactions from all of your credit cards out of [Mint] and put them into [Splitwise]. Mint is a free<sup>1</sup> webapp that aggregates all of the transactions from all of your provided financial institutions to show you a snapshot of your finances. It also employs machine learning to categorize your expenses, to help you track how you're spending your money. Because I already use Mint, I thought it would be convenient if I could export selected expenses from Mint into Splitwise. Unfortunately, Mint does not have a public API, but luckily, there's an open-source Javascript SDK for scraping your transactions off of the Mint webapp, [pepper-mint]. On the other hand, Splitwise _does_ have [a public API][splitwise-api], so once I had a way to export all of my credit card transactions from Mint, importing them into Splitwise was straightforward.

## Some ways that this was totally over engineered

mintwise offers the following features:
- shows you your expenses one-by-one and allows you to select whether or not you want to split them
- automatically translates Mint categories into Splitwise categories (if it doesn't know the mapping, it'll ask you and then save it)
- allows you to specify a date range from which to pull expenses
- lets you specify which accounts are in Canadian dollars (because thats something [Mint doesn't track for some reason][mint-usd-cad])
- offers alternate import experience where you export your Mint transactions as a CSV, and use that to import transactions into Splitwise

While I didn't write any tests for mintwise, in order to make it easier to refactor, I used type checking in Node.js using [Flow's comment syntax] (so that I didn't have to introduce Webpack to strip out annotations.) I also tried my hand at using the MVC (Model, View, Controller) pattern for a CLI app.

## Conclusion

In the end, I have probably spent way more time writing mintwise than I ever would have manually entering expenses into Splitwise. My partner has a much simpler solution, just use one credit card for shared expenses.

However, I had a really good time working on mintwise. When I am working my day job, I have to be careful not to fall in the trap of over engineering a solution and pushing back the deliverable from what the team estimated. So it's nice to come home, put on my cowboy hat, and ride off into the sunset.

[Try out mintwise for yourself.][mintwise]

-----------
1: Mint is provided for free from Intuit, who makes money by [anonymizing, packing up, and selling your financial data to third parties][mint-business-strategy].

[Splitwise]: https://splitwise.com
[mintwise]: https://github.com/motevets/mintwise
[Mint]: https://mint.com
[mint-business-strategy]: https://www.investopedia.com/articles/personal-finance/082216/how-mintcom-makes-money-intu.asp
[pepper-mint]: https://github.com/dhleong/pepper-mint
[splitwise-api]: https://dev.splitwise.com/#introduction
[mint-usd-cad]: https://www.reddit.com/r/PersonalFinanceCanada/comments/4vom5o/mint_with_usd_and_cad_accounts/
[Flow's comment syntax]: https://flow.org/en/docs/types/comments/