Skate is a web-based dispatch tool for bus inspectors, built by the MBTA. Imagine an app that helps you track the one bus you want to catch, but instead it’s helping us track all the buses that everyone wants to catch! It has the rich location data driving our mbta.com and rider apps, but also info that matters for keeping things running smoothly (operator names, bus numbers, shift schedules). For background, read our “Skate: Building a better bus dispatch app (and how it will improve your ride)” blog post.
The MBTA Customer Technology Department supports a shared Slack channel that transit agencies and partners adapting the Skate code can use to collaborate and ask questions. To be invited to the Slack channel, email developer@mbta.com.
Doing development on Skate requires Elixir, Erlang, and node, as described in .tool-versions. Most developers use asdf to help manage the required versions, but that isn't required.
Skate also requires Postgres. If you don't already have Postgres installed, and you're on a Mac, Postgres.app is an easy way to get started. However, any Postgres instance to which you can connect and in which you have sufficient privileges should work.
There are a number of configuration details defined in environment variables. These define where data sources live, as well as authentication and CDN details. In our AWS environments these are all set and managed via Terraform.
To avoid having to set these manually in your local development environment, direnv is strongly recommended. A .envrc.template
file is provided to fill out; simply copy it over to .envrc.private
and fill in the values, then follow the direnv documentation to load it.
The environment variables are documented in the Skate .envrc.template
file.
Note
Some of these configuration values are shared between Skate team members.
While there are still some values which are not shared and need to be configured in
.envrc.private
, to facilitate easier setup and to reduce the amount of work done when cloning
for team members, the .envrc
file is configured to source the shared
configuration values from 1Password using the
.env.1p.skate file and the 1Password CLI (which you must also have on your system).
Here are the values you'll need to be prepared to update to run Skate locally:
- Your local Postgres server username and password
- Your personal API key from MBTA Realtime API; request one if you don't have one
- API key from Swiftly Transitime API
- Install language dependencies with
asdf install
- Setup project with
mix setup
- This command will create the database, so you must first ensure your Postgres server is running and you've updated your credentials in
.envrc.private
as described in "Configuration" above.
- This command will create the database, so you must first ensure your Postgres server is running and you've updated your credentials in
- (not necessary to run the application)
- The
test
command will automatically setup the database when run. - You can setup the the testing database manually by running
mix ecto.setup
in thetest
envrionment specified viaMIX_ENV
$ MIX_ENV=test mix ecto.setup
- The