$ show BlinkTagInc/node-gtfs
node-gtfs is a comprehensive Node.js library and CLI toolkit for ingesting, querying, exporting, and updating GTFS (General Transit Feed Specification) transit data. It supports SQLite natively and PostgreSQL/MySQL through Kysely, handling static schedule feeds, GTFS Realtime (alerts, trip updates, vehicle positions), and extended standards (GTFS-Plus, GTFS-Ride, GTFS-to-HTML, TODS, TIDES, NOPTIS). The architecture centers on a declarative schema definition system that compiles to SQL table metadata, enabling robust import/export pipelines and a rich query API with ~50 getter functions. The codebase demonstrates strong engineering practices: parameterized SQL builders, structured error handling, configurable reporting, and comprehensive test coverage. It is actively maintained, uses modern tooling (pnpm, TypeScript, ESM), and provides a reusable foundation for transit data applications.
The LLM identified 4 files worth highlighting for reuse:
Provides a declarative DSL for defining GTFS table schemas, including field kinds, constraints, indexes, and presence rules. Compiles to metadata for SQL generation. Demonstrates elegant type-level programming in TypeScript, enabling both strong typing and runtime schema introspection.
Builds SQL WHERE, SELECT, ORDER BY, and JOIN clauses with proper escaping and parameter binding. Supports bounding box conditions for spatial queries and feed prefixing. Reusable for any SQL generation task in JS/TS, with careful handling of array expansions and dialect-neutral patterns.
Functions for converting between seconds from midnight, Date objects, and GTFS time format (HH:MM:SS). Includes day-of-week calculation and handling of times exceeding 24:00:00 (long times). Standalone module with no internal dependencies, reusable for any transit data processing.
Simple utility to apply a configurable prefix to identifiers (e.g., agency IDs, route IDs) when importing multiple feed sources. Enables collision-free merging of data from different transit agencies into a single database. Clean, isolated pattern with minimal coupling.