Barn is a vehicle maintenance journal for everyone.
Backend
Frontend
Operations
Barn is a personal project to create a better way of recording maintenance work on my own car and those of friends and family.
My requirements for the project were pretty straightforward:
Below is a screenshot of the notion database I was using previously.
Excel sets a very high bar for data management but most web and IOS maintenance trackers fail to exceed the features of a simple spreadsheet. Applications for commercial fleet management met most of my requirements but were unwieldly and charged exorbitant monthly subscriptions for what’s essentially a CRUD app.
The Barn back-end is a fairly standard Django + Django REST Framework API implementation. The front-end is a Svelte + Sveltekit MPA.
The Barn UI was designed to have the information density of a spreadsheet with the usability and readability of a modern website. The layout and theming was heavily influenced by Github and their impressive ability to communicate features with different shades of gray. The UI was implemented using TailwindCSS, Inter, Heroicons, and a simple grayscale palette.
Below is a development preview of the maintenance records list view.
I love that people name their cars so vehicle names are used as the primary identifier across the front-end.
Below is a development preview of the vehicle list view.
Vehicle records include a specification with a year, make, and model. This will be expanded to incorporate more information from NHTSA databases such as the manufacturing series, engine model, and safety recalls.
Most websites use three dropdown selects to search vehicle specifications by year, make, and model. I’ve always found these tedious and wanted to implement a simpler form using filtered text search.
Below is a development preview of the vehicle creation form.
Simple text search was insufficient for searching vehicle specifications. The model name conventions used by different manufacturers vary (ES-350, Silverado 2500 Crew, etc.) and text matching was often confused by contractions and the relevance of numbers appearing in the year and model columns.
I had originally planned on using Algolia for vehicle spec search. However, after reading the documentation it was clear that most Algolia search products are APIs for PostgreSQL features.
The performance and accuracy of the PostgreSQL trigram search extension is really impressive. It can usually return relevant results despite misspellings, contractions, and varied search term ordering.
A lot of work has also been done by the Django development team integrating PostgreSQL search features into the ORM. As of Django 4.2 integrating PostgreSQL trigram search only requires adding the pg_trgm
extension to the project migration files and importing django.contrib.postgres.search
modules.
Below is the function used to search vehicle specs using trigram similarity.
def apply_trigram_search(
self,
searchQuery: str | None,
query: Manager[Spec]
):
if searchQuery:
trigram = (
TrigramSimilarity("year", searchQuery)
+ TrigramSimilarity("make", searchQuery)
+ TrigramSimilarity("model", searchQuery)
)
query = (
query.annotate(similarity=(trigram))
.filter(
# There's a lot of 1 or 2 letter word
# matches so this threshold isn't always helpful
similarity__gte=0.0
)
.order_by("-similarity")
)
return query
A parts finder was beyond the scope of this project and it’s unlikely I could create something as refined and efficient as the RockAuto parts search. Part detail views will eventually include a purchase history and what vehicles they’re compatible with.
Barn is still under active development and is not available as a service.