I Created Something With Phoenix

09. November 2016 Uncategorized 0

For those that don’t know, I actually run two blogs. I have this one where I talk primarily about software development, and I have CouchJitsu where I talk about another hobby: Brazilian Jiu Jitsu.  I’ve been training BJJ for a little over 4 years now and I really enjoy it.  Not long after I started training, I made it a point to see how much time I spent on the mat in various ways. I even wrote an application for it and wrote a blog post about it (see: Learning By Writing a Simple Application.) It was nothing fancy just a way to come home from the gym and type in that I did a sparring class, or a judo class, or whatever. That app has run, largely untouched, for the past 3.5 years.

I’d started a time or two rewriting it in Node, or doing things better with Angular, but I never completed it.  Even though I had changes I wanted to implement, I just didn’t have the motivation to pull it off. Then, I started playing with Elixir, and it’s web framework Phoenix.

I really enjoyed Elixir, it was fun and challenging me to think about new ways to solve problems. It was with the motivation of wanting to learn Phoenix better that I decided I would update the Couchjitsu tracker.

My first challenge was I didn’t want to use Bootstrap. Instead, I wanted to use Semantic UI. As a framework that made more sense to me, and helps me think about CSS in a more intelligent way than other frameworks do.  So I ripped out Bootstrap and also ripped out BrunchJS, which is the default packaging & build tool that Phoenix uses. I replaced it with Webpack.

Once I got that done, I needed to migrate my data. The original app used Mongo for a variety of reasons. And for a variety of different reasons I didn’t want to use Mongo for this version, I wanted a relational database. That worked out perfectly as Phoenix defaults to using Postgres, but I didn’t want to lose my existing data. So I wrote an Elixir app that would pull in data from Mongo and create relational data in Postgres.

Then I moved on to displaying a list of data. Essentially, show me everything that I’ve ever done at the gym.  From there it was simply feature after feature of things I wanted.  You can check out the screenshots over at CouchJitsu.

I had a few challenges along the way. The first was deployment. Phoenix works easily enough with Heroku, but I wasn’t 100% I wanted to use Heroku (in the end I went with them.)  The other challenge I had was the occasional issue I’d have with an Elixir package. Usually it was me doing something dumb, for example, I forgot to tell my application to start Timex when it ran, so none of the Timex function calls were working.

Overall, it was a very fun process. I enjoyed writing the application. Phoenix was a fun framework to use.  I had debated earlier about using Ember or React with a Phoenix API, but ended up going with server rendered views for one simple reason: My application was so simple that adding a lot of clientside dependencies wasn’t worth it.

I look forward to other Phoenix apps that I can write, and more time I can spend playing with it and Elixir.