Day 1 of Writing a Webapp: Getting My Hands Dirty with NodeJS, Express, and MongoDB

On any given day I probably have at least a dozen new ideas of what to build floating around in my head, but for one reason or another most come and go without much further thought. About a year ago now one of those ideas floated into my head, and ever since it hasn't left.

Rather than letting this idea continue to nag at the back of my mind I've finally decided to do something about it, and will periodically blog about it along the way to help keep myself accountable and self-reflect along the way.

The Problem, The Solution

Without a doubt the biggest pain year-after-year as a self-employed individual is keeping my finances in order and paying my taxes upfront/on time. Almost every how-to or blog article about getting started on your own business repeatedly screams at you to stay on top of your finances, yet it seems to repeatedly be one of the most common problems for almost every recently self-employed individual I meet. There's tons of financial software out there, but it's almost always targeted at accountants or larger businesses (overkill for a contractor), or is meant for people who are employed full time by the same company. Instead, contractors/freelancers are left hodge-podging all their finance information together using various different software that provide subpar solutions[1]. Ironically the best piece of software I've used for tracking my expenses has been Freshbooks, an amazing SAAS product whose primary purpose is instead for invoicing.

Enter Transact — my plan for a simple web and mobile app that helps me keep track of not only my income and expenses, but also details about each expense to create a clear paper trail. Right now I'm just trying to hit my head against a wall build a [mostly] functional webapp that consumes its own API, that can then be reused to connect to from a React Native powered iOS/Android application.

This might be naive, but I figure if I can build an app that I personally find useful and streamlined enough to use on a day-to-day basis, then there's probably other self-employed people out there who will find value in it.

Stepping Off the Deep End

I'm a designer and frontend developer by practice, so delving into backend code is always a little awkward. On the other hand, writing a backend application from scratch feels completely insane.

Prior to leaving San Francisco I briefly started working on the same idea with my friend and backend developer extraordinaire Dev, who started hobbling together a proof-of-concept Rails API for our purposes.

Unfortunately, I don't know Rails.

On more than one occasion I've tried to teach myself, but without the ability to dedicate a long period of time to learning the syntax, lingo, and other "gotchas" of the Rails ecosystem it would be an excruciatingly slow, painful march of progress, and at this point I just want to get something rolling.

The good news is I do know javascript, and have spent my fair share of time working within the confines of NodeJS/Express applications in the past (albeit mostly on the frontend). I'm sure there's a hundred reasons why “Framework A is more suited to this than NodeJS” or how “NodeJS really sucks and is going to cause problems in a year”, but for now I just need to optimize for progress based on what I already know and am at least vaguely familiar with.

![Screenshot of ExpressJS App Source](/content/images/2016/10/1-2.jpg)
Screenshot of the code-in-progress...So far its been a constant “be confused for 2+ hours, solve one tiny problem” sort of day.

Progress So Far

I'm writing this as a brief break from coding, but as of this afternoon I've managed to scrape together a basic ExpressJS + MongoDB application with user authentication using the Node Passport package that has its own API that it self-consumes so adding other clients (iOS/Android) in the future will be a much smoother process. Currently I'm using Babel to enable using ES2015 (ES6) syntax and ESLint to help keep my code quality in check.

I'm admittedly a little wary of using MongoDB as heard some of the scaling horror stories, but for now it's the fastest and easiest way to get things up and moving (famous last words?). So far its running without a hitch, though I'm still a little fuzzy on some of the core concepts, especially around how Mongoose abstracts interacting with Mongo and how you properly reference models from one another using Mongoose's helpers.

For getting bank transaction data I'm testing out the Plaid API, which as far as I can tell is the only option out there short of writing your own custom bank integrations (no thanks). Thankfully, their documentation and API are in the best of their class and they include libraries for most major backend languages/frameworks.

![Screenshot of Plaid Documentation](/content/images/2016/10/2-1.jpg)
Think you've got good docs?Here's a snippet of Plaid's Connect docs, which is the basic endpoint allowing you to pull in both general bank account information as well as detailed transaction data. They're without a doubt some of the clearest, best docs I've ever seen.

Overall I have to say I'm really impressed with how the Node ecosystem has grown since I last looked at it, and how quickly I've been able to get a basic server application running. On the downside, it seems to be weirdly difficult to find good, complex Node/Express applications to use as a point of reference compared to other large communities (aka Rails, Backbone, React, etc). Over the next few days I hope to better learn how Mongoose (the Mongo ODM) works, be able to pull real bank data from my own Wells Fargo business accounts, and start calculating a rough estimated amount for how much tax I owe based a simple calculation of income minus expenses.

  1. I tested out Intuit's “Quickbooks Self Employed” but received an error when trying to connect my Wells Fargo Business Account. That aside, after connecting my person account it still seemed to be riddled with bugs and didn't serve the purpose I'm looking to fill. That said, the fact that a company as large as Intuit is working a product targeting self-employed workers only helps prove how large of a market freelancers are becoming, especially with the proliferation of contractor-based companies like Uber. ↩︎