Sinatra Car Maintenance Tracker

The Sinatra Car Maintenance Tracker is my first real web application, utilizing the Sinatra framework, Rack, and Active Record. I went through a number of different ideas (exercise tracker, chess game tracker) and rebuilt my application several times before I finally settled on the car maintenance tracker. Basically, it allows a user to keep track of the maintenance records for their vehicle. As a car owner (1999 Honda Civic), I’ve never been good at tracking my maintenance (I’m one of those people who prefers to do the maintenance myself, instead of taking it to a mechanic).

As a result, I find myself guessing when it’s time to change my oil, replace break pads, inspect the vehicle, etc. Even though my vehicle manual has suggested dates for different types of maintenance, I’ve done lots of work at points outside of those dates. While there are probably plenty of applications that can track car maintenance, I thought it would be fun to build something myself.

sinatra car maintenance tracker dashboard

The car maintenance tracker supports user login / logout and authentication, secure passwords using the Bcrypt gem and has a number of different controls to prevent bad data from being created and prevent Users from accessing or editing other accounts. Users can create cars and access them through their account dashboard. Under each car, maintenance logs can be edited and deleted.

I made sure to include Active Record delete/destroy dependencies in my models, so when a User or a Car is deleted, all of it’s associated records are in the database are deleted as well. While ActiveRecord does natively support delete/destroy dependencies, these didn’t seem to work so I added some extra callbacks to ensure the associated records are deleted.

I also used Bootstrap to quickly create a clean, simple user interface for the car maintenance tracker application. I used the Bootstrap example theme with some of my own custom CSS to style all of my view pages within a few hours.

Check out the Sinatra Car Maintenance Tracker in action:

I am considering deploying a live version of this on my site, but in the mean time, check out the Sinatra Car Maintenance Track repo on Github .

Thoughts on possible improvements:

– Add support for multiple types of Vehicle objects (eg motorcycles, bicycles, etc.)
– Calculations for the next recommended service date for each maintenance. While maintenance varies from vehicle to vehicle, certain things are usually a safe bet (change oil / oil filter roughly every 5,000 miles, visual inspection once a month, etc.).
– Notifications of when it’s time to perform maintenance. This would be extremely helpful.
– Record ERB templates in HAML. I discovered HAML near the end of my build and played around with it briefly. It seems much more intuitive and pleasant to use than combining Ruby and HTML, and creates a cleaner file to work with.

Suggestions for the Sinatra Car Maintenance Tracker? Leave them in the comments or shoot me an email at mail@mattcassara.com.

Leave a Reply

Your email address will not be published. Required fields are marked *