A TypeScript library for loading GTFS (General Transit Feed Specification) data into a SQLite database, queryable in browser, Node.js, and React Native environments. v0.7.0 stable with monthly releases. Differentiates from node-gtfs by offering pluggable database adapters (sql.js, better-sqlite3, op-sqlite, expo-sqlite) and first-class browser support via WASM. Features progress tracking, GTFS-RT realtime feeds, and optional caching with platform-specific stores. Fully typed, ESM-only, Node >=18.
npm install gtfs-sqljsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates loading a GTFS ZIP file with better-sqlite3 adapter, skipping shapes, and querying bus routes.
Install sql.js or better-sqlite3 as peer dep and pass adapter to fromZip/fromZipData/fromDatabase.
Add await or .then() to all query calls (e.g., await gtfs.queryRoutes()).
Create instance first: const gtfs = new GtfsSqlJs(); gtfs.attach(dbHandle);
Use subpath imports: 'gtfs-sqljs/adapters/sql-js' for adapters.
Use better-sqlite3 in Node or stream data with custom adapter.
Copy IndexedDBCacheStore or FileSystemCacheStore into your project.
import { GtfsSqlJs } from 'gtfs-sqljs'; (named import, not default)Pass adapter option: await GtfsSqlJs.fromZip(url, { adapter: createSqlJsAdapter() })Ensure bundler supports package.json exports field, or use direct path: 'gtfs-sqljs/dist/adapters/better-sqlite3/index.js'
Ensure fromZip() completes before querying, and do not skip 'agency.txt'.