(formerly next-departures)
- Shows upcoming departure times based on ETS GTFS Schedule data for geographically closest LRT station.
- View the app online at:
- Primary URL: headway.andy.ws
- Fly.io URL: next-departures.fly.dev
- Relies heavily on
node-gtfsto parse and import GTFS CSV data into an sqlite database. - Analytics powered by Umami (free cloud plan)
# npm run db:update performs the following:
# npx gtfs-import --configPath ./import-config.json
# sqlite3 db/gtfs.db < scripts/build_lrt_only_db.sql
npm run db:update
# npm run deploy
# ↳ npm run build && fly deploy
# `npm run build` consists of:
# ↳ npm run build:client
# ↳ npm run build:server
npm run deployOther useful package.json scripts:
Build and serve the build locally for evaluting:
npm run previewThe GTFS Schedule data will have to be manually updated periodically — once a week should suffice.
I have not automated this process yet.
See "How to build and deploy" for instructions on how this is accomplished.
- Fill out
import-config.jsonandapp-config.json - Run
npm run db:update(note: this can take a minute or two) - Run
npm run dev
Important: For fast deployment, build locally first rather than letting Fly.io build remotely.
- Fill out
import-config.jsonandapp-config.json - Run
npm run db:update(note: this can take a minute or two)- fetches gtfs data and imports it into
db/gtfs.db - creates new slim database from
db/gtfs.dbatdata/gtfs_lrt_only.db
- fetches gtfs data and imports it into
- Run
npm run build:all(builds locally for faster deployment) - Run
fly deploy(uses pre-built artifacts, much faster than remote build)
npm run deployThis runs npm run build:all && fly deploy - builds everything locally then deploys.
See also package.json script npm run db:update described below.
# imports gtfs data into sqlite db './db/gtfs.db'
# you can also run:
# npm run db:import
npx gtfs-import --configPath import-config.json
# creates a slim version of our `./db/gtfs.db` at `./db/gtfs_lrt_only.db`
# you can also run:
# npm run db:slim
sqlite3 db/gtfs.db < scripts/build_lrt_only_db.sqlrun this as of 25-09-19
For creating the slim database with operational stop filtering (recommended):
# Creates filtered slim database excluding operational/maintenance stops
# Outputs to ./data/gtfs_lrt_only.db
npm run db:slim-filteredOr run the SQL script directly:
sqlite3 db/gtfs.db < scripts/build_lrt_only_filtered.sqlThe original (unfiltered) SQL script is also available but not recommended for production:
# creates a slim version of our `./db/gtfs.db` at `./db/gtfs_lrt_only.db`
# *should* leave original alone...
sqlite3 -batch db/gtfs.db < scripts/build_lrt_only.sql# Builds and deploys our app to fly.io so it is live
# https://headway.andy.ws (primary)
# https://next-departures.fly.dev (fly.io)
fly deployCustom Domain Setup: The app is accessible via both:
headway.andy.ws- Custom domain with SSL certificate managed by Fly.ionext-departures.fly.dev- Original Fly.io domain
DNS is configured with CNAME records pointing to Fly.io infrastructure. SSL certificates auto-renew via Let's Encrypt.
Analytics:
Privacy-friendly analytics powered by Umami (free cloud plan). Tracking script is loaded client-side from cloud.umami.is. No server configuration required.
# 1. Fetches latest ETS transit data
# 2. Parses it into SQLite database initial Sqlite DB
# 3. Runs sql script to create our "slim" DB which is what our app uses
# and is what we deploy to production
npm run db:update
# Starts our express api server & vite ui at the same time
npm run dev
# Builds front end and API
npm run build:all
# Builds are project and runs our static entrypoint with node
npm run previewabout:config -> geo.provider.testing -> true
about:config -> geo.provider.network.url -> data:application/json,{"location": {"lat": 53.50584, "lng": -113.52845}, "accuracy": 27000.0}
about:config -> geo.wifi.uri -> data:application/json,{"location": {"lat": 53.50584, "lng": -113.52845}, "accuracy": 27000.0}
https://security.stackexchange.com/questions/147166/how-can-you-fake-geolocation-in-firefox