Living in Cambridge, MA without a car, I have learned to ride the T, Boston’s subway system operated by the MBTA. This has been a pleasant experience overall and I have enjoyed the relative flexibility and independence brought by public transit.

Recently I became curious about the characteristics and history of the passenger cars I rode. Every transit system has a “rolling stock” representing all the active train cars. As of November, 2016 the New York City Subway’s rolling stock includes 6418 cars on the roster. In Boston, we have 719 cars across all our lines excluding the Commuter Rail based on information available on roster.transithistory.org. While ridership, distance, and funding represent better heuristics for understanding the relative size and sophistication of transit systems, I find the immediate tangibility of the cars themselves oddly appealing.

Public transit seems to foster plenty of discussion on the web. Some active communities I have found include Railroad.net and r/transit. In a similar vein, I particularly enjoyed a lovely, bittersweet write up on r/CambridgeMA entitled “The experience of riding the ’last’ trackless trolley late last night”. Some people have used the data produced by these systems to create interesting visualizations such as Visualizing MBTA Data.

When I found myself in a particularly dated looking Orange line car, I decided to Google the car number out of curiosity. Using the old trick from high school teachers on using the Wikipedia references to do research, I eventually found a comprehensive catalog of the MBTA roster at roster.transithistory.org. By scrolling through the long, plain HTML document likely exported directly from Microsoft Word, I was able to see the manufacturer, year built, and dimensions of the train car. This was a slightly inconvenient way of looking up information though – I would like to input the number on the side of the car and get the information directly. I also thought it would be neat to track which cars I ride to calculate some fun metrics like the percentage of the rolling stock I’ve ridden or the individual car I ride the most. Lastly, when searching “MBTA ${train number}” I found some tweets directed to @MBTA concerning the car. While these mostly consist of reports involving bodily fluids and delays, I think a social component of writing messages on the car’s page could be intriguing.

With these ideas in mind, I began building the MBTA Ride Tracker. This project currently consists of a SQLite database containing a (terribly) normalized representation of the T’s rolling stock, users, and individual rides. I wrote a basic backend in Go wiring up the data model to an API. Perhaps I’m spoiled by a brief fling with Django in college, but I found the verbose boilerplate of writing authentication, user registration, and basic CRUD in Go to be quite tedious even when aided by Gin, GORM, and plenty of GitHub Copilot snippets (this was particularly exciting, I was blown away by how much boilerplate Copilot can correctly spit out). For the frontend, I hacked together a React application in TypeScript mostly out of hastily glued together Chakra UI components. I found similar tones of monotony plumbing form values, tabulating data, and wrestling with CSS. I didn’t bother synchronizing the models between server and client which is pretty sloppy and inadvisable – perhaps some protobufs would help here, but I wanted to focus on finishing an MVP over perfecting the tooling. You can find the work in progress code at https://github.com/JacobGo/mbta.

Current features:

  • User registration and authentication
  • Track personal subway rides on the Red Line

Planned features:

  • Support for other lines
  • Global leaderboard
  • Improved display of train information with visuals and randomized fun facts
  • Stats on previous rides, most ridden trains, and percentage of rolling stock ridden so far. Achievements?
  • Social feature: comments and voting systems

For the next blog post I’ll work on implementing some of these features and begin serving a production, containerized version of the project so that people can start using it.

Demo