10 May

Teaching an old dog new tricks

For the last 10+ years I’ve primarily been a C# / .NET developer. This ecosystem is great, there are thousands of great packages available. The one thing that’s been irritating me of late is the challenge of running .NET in containers such as Docker.

As luck would have it, I recently got an opportunity to work on a new side project FairDealFx which I (perhaps stupidly) decided to do using the MEAN stack (MongoDb, ExpressJs, Angular and Node). I’ve done some javascript and typescript as part of web projects in the past, but not an entire application stack.

This undertaking began as an offer to help a friend out with a project he had been working on in his spare time. His prototype was working well but I didn’t think it would scale too well, so I offered to help refactor it a bit. This is when I got entirely carried away and picked a whole new tech stack.

Before, The original stack

MySQL, PHP, jQuery, Python

The original codebase worked fine, but in my eyes I could pick a couple of key areas where scaling or supportability was going to become challenging.

After, The ambitious new stack

MongoDb, Redis, Auth0, NodeJs, ExpressJs, Angular 2, Docker, Rancher, Drone, Azure

## Key lessons

  1. Embrace the container world:
  2. Smaller services and decoupled architecture is great – there’s much less you need to keep in your head.
  3. The ability to add new data providers or other integration services at a later date without redeploying the whole solution has been great.
  4. The isolation of containers means you can test a lot more on a local development environment.
  5. Be aware of the pricing model of PaaS offerings. We have a BizSpark subscription, so I decided to use Azure DocumentDb with MongoDb support enabled. The problem with this approach is that you pay per collection! This meant that with 4-5 collections, our monthly credit rapidly ran out. I ended up using mLab’s hosted MongoDb for the time being to avoid having to set up a MongoDb cluster.
  6. Adopting new frameworks (Angular 2) is great, but be ready for instability and a constantly moving foundation. In a 2 month period the Angular 2 project changed the way the router worked and switched from SystemJs to Webpack for builds. The changes themselves are probably only 20% of the pain, you spend 80% of your time finding blog posts with answers to obsolete problems.
  7. When working on a startup project, don’t build stuff you don’t need to. There are so many services out there with free or low cost tiers:
  8. Auth0 for authentication, rather than dealing with the hassle of running a password database and all the associated work for resets and verifications – outsource that problem!
  9. mLab for MongoDb hosting. I’m no MongoDb expert, so I would rather not run my own instance just yet. (especially on Docker where I’m unsure of the failure modes)

What’s next?

I’m going to do some follow up posts on some of the details here. In particular Drone and Rancher.