{"id":18449447,"url":"https://github.com/public-transport/db-hafas","last_synced_at":"2026-03-05T00:32:43.720Z","repository":{"id":66219652,"uuid":"52643386","full_name":"public-transport/db-hafas","owner":"public-transport","description":"JavaScript client for the Deutsche Bahn HAFAS API.","archived":false,"fork":false,"pushed_at":"2025-01-17T12:30:05.000Z","size":142,"stargazers_count":79,"open_issues_count":5,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-10-27T06:28:09.392Z","etag":null,"topics":["api","deutsche-bahn","germany","transit","transport"],"latest_commit_sha":null,"homepage":"https://github.com/public-transport/db-hafas","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/public-transport.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-02-27T01:16:51.000Z","updated_at":"2025-09-03T19:50:04.000Z","dependencies_parsed_at":"2025-04-21T19:21:15.307Z","dependency_job_id":"be3a06ce-05c3-4fa1-ac0b-6225f7f45e5f","html_url":"https://github.com/public-transport/db-hafas","commit_stats":{"total_commits":114,"total_committers":2,"mean_commits":57.0,"dds":"0.052631578947368474","last_synced_commit":"38dd18195dcc075a481c20036fbcc1069eebbffd"},"previous_names":["derhuerst/db-hafas"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/public-transport/db-hafas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/public-transport%2Fdb-hafas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/public-transport%2Fdb-hafas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/public-transport%2Fdb-hafas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/public-transport%2Fdb-hafas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/public-transport","download_url":"https://codeload.github.com/public-transport/db-hafas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/public-transport%2Fdb-hafas/sbom","scorecard":{"id":749041,"data":{"date":"2025-08-11","repo":{"name":"github.com/public-transport/db-hafas","commit":"9594d87314043a11d2c157c79fb27e6ff422bc7d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/public-transport/db-hafas/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/public-transport/db-hafas/test.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/test.yml:26","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license.md:0","Info: FSF or OSI recognized license: ISC License: license.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T19:43:03.974Z","repository_id":66219652,"created_at":"2025-08-22T19:43:03.974Z","updated_at":"2025-08-22T19:43:03.974Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30102396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T23:59:36.199Z","status":"ssl_error","status_checked_at":"2026-03-04T23:56:48.556Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","deutsche-bahn","germany","transit","transport"],"created_at":"2024-11-06T07:20:10.499Z","updated_at":"2026-03-05T00:32:43.696Z","avatar_url":"https://github.com/public-transport.png","language":"JavaScript","funding_links":["https://github.com/sponsors/derhuerst"],"categories":[],"sub_categories":[],"readme":"# db-hafas\n\n**A client for the German Railways (DB).** It acts as a consistent and straightforward interface on top of a verbose API.\n\nThis project is actually a thin wrapper around [`hafas-client@6`](https://github.com/public-transport/hafas-client/blob/6/readme.md). [Its docs](https://github.com/public-transport/hafas-client/blob/6/docs/readme.md) document the API in general.\n\n\u003e [!IMPORTANT]\n\u003e The [DB HAFAS API is currently not available](https://github.com/public-transport/hafas-client/issues/331), and it seems like it has been shut off permanently.\n\u003e We **recommend using [`db-vendo-client`](https://github.com/public-transport/db-vendo-client)** as a replacement. It covers most of the use cases served by `hafas-client`, but [the underlying APIs seem to have a **much lower rate limit**](https://github.com/public-transport/db-vendo-client/issues/10). ⚠️\n\n[![npm version](https://img.shields.io/npm/v/db-hafas.svg)](https://www.npmjs.com/package/db-hafas)\n![ISC-licensed](https://img.shields.io/github/license/public-transport/db-hafas.svg)\n[![support me via GitHub Sponsors](https://img.shields.io/badge/support%20me-donate-fa7664.svg)](https://github.com/sponsors/derhuerst)\n[![chat with me on Twitter](https://img.shields.io/badge/chat%20with%20me-on%20Twitter-1da1f2.svg)](https://twitter.com/derhuerst)\n\n\n## Installing\n\n```shell\nnpm install db-hafas\n```\n\n\n## API\n\nCheck [the docs for `hafas-client@6`](https://github.com/public-transport/hafas-client/tree/6/docs) as well as [its DB-specific customisations](https://github.com/public-transport/hafas-client/blob/6/p/db/readme.md).\n\n\n## Getting Started\n\n```javascript\nimport {createDbHafas} from 'db-hafas'\n\nconst hafas = createDbHafas('my-awesome-program')\n```\n\nAs an example, we will search for a route from *Berlin Jungfernheide* to *München Hbf*. To get the station IDs, use [`locations(query, [opt])`](https://github.com/public-transport/hafas-client/blob/6/docs/locations.md).\n\n```javascript\n// Berlin Jungfernheide to München Hbf\nconst {journeys} = await hafas.journeys('8011167', '8000261', {\n\tresults: 1,\n})\nconsole.log(journeys[0])\n```\n\nThe output will be an array of [`journey` objects in the *Friendly Public Transport Format* `1.2.1` format](https://github.com/public-transport/friendly-public-transport-format/tree/1.2.1/spec#journey):\n\n```javascript\n[ {\n\ttype: 'journey',\n\tlegs: [ {\n\t\ttripId: '1|300793|27|80|27032019',\n\t\torigin: {\n\t\t\ttype: 'stop',\n\t\t\tid: '8089100',\n\t\t\tname: 'Berlin Jungfernheide (S)',\n\t\t\tlocation: {\n\t\t\t\ttype: 'location',\n\t\t\t\tid: '8089100',\n\t\t\t\tlatitude: 52.530408,\n\t\t\t\tlongitude: 13.299424\n\t\t\t},\n\t\t\tproducts: {\n\t\t\t\tnationalExpress: false,\n\t\t\t\tnational: false,\n\t\t\t\tregionalExp: false,\n\t\t\t\tregional: true,\n\t\t\t\tsuburban: true,\n\t\t\t\tbus: true,\n\t\t\t\tferry: false,\n\t\t\t\tsubway: true,\n\t\t\t\ttram: false,\n\t\t\t\ttaxi: false\n\t\t\t},\n\t\t\tstation: {\n\t\t\t\ttype: 'station',\n\t\t\t\tid: '8011167',\n\t\t\t\tname: 'Berlin Jungfernheide',\n\t\t\t\tlocation: { /* … */ },\n\t\t\t\tproducts: { /* … */ }\n\t\t\t}\n\t\t},\n\t\tdeparture: '2019-03-27T14:10:00.000+01:00',\n\t\tdepartureDelay: 0,\n\t\tdeparturePlatform: '6',\n\t\tdestination: {\n\t\t\ttype: 'stop',\n\t\t\tid: '8089073',\n\t\t\tname: 'Berlin Südkreuz (S)',\n\t\t\tlocation: { /* … */ },\n\t\t\tproducts: { /* … */ },\n\t\t\tstation: { /* … */ }\n\t\t},\n\t\tarrival: '2019-03-27T14:30:00.000+01:00',\n\t\tarrivalDelay: 0,\n\t\tarrivalPlatform: '12',\n\t\tdirection: 'Berlin Südkreuz (S)',\n\t\tline: {\n\t\t\ttype: 'line',\n\t\t\tid: 's-42',\n\t\t\tfahrtNr: '42133',\n\t\t\tname: 'S 42',\n\t\t\tpublic: true,\n\t\t\tmode: 'train',\n\t\t\tproduct: 'suburban',\n\t\t\toperator: {type: 'operator', id: 's-bahn-berlin', name: 'S-Bahn Berlin'}\n\t\t},\n\t\tcycle: {min: 300, max: 300, nr: 25}\n\t}, {\n\t\torigin: { /* … */ },\n\t\tdeparture: '2019-03-27T14:30:00.000+01:00',\n\t\tdestination: { /* … */ },\n\t\tarrival: '2019-03-27T14:37:00.000+01:00',\n\t\tpublic: true,\n\t\twalking: true,\n\t\tdistance: 622\n\t}, {\n\t\ttripId: '1|245684|0|80|27032019',\n\t\torigin: { /* … */ },\n\t\tdeparture: '2019-03-27T14:37:00.000+01:00',\n\t\tdepartureDelay: 0,\n\t\tdeparturePlatform: '3',\n\t\tdestination: {\n\t\t\ttype: 'stop',\n\t\t\tid: '8000261',\n\t\t\tname: 'München Hbf',\n\t\t\tlocation: { /* … */ },\n\t\t\tproducts: { /* … */ }\n\t\t},\n\t\tarrival: '2019-03-27T19:06:00.000+01:00',\n\t\tarrivalDelay: 0,\n\t\tarrivalPlatform: '18',\n\t\tdirection: 'München Hbf'\n\t\tline: {\n\t\t\ttype: 'line',\n\t\t\tid: 'ice-1601',\n\t\t\tfahrtNr: '1601',\n\t\t\tname: 'ICE 1601',\n\t\t\tpublic: true,\n\t\t\tmode: 'train',\n\t\t\tproduct: 'nationalExpress',\n\t\t\toperator: { /* … */ }\n\t\t},\n\t} ],\n\trefreshToken: '…',\n\tprice: {amount: null, hint: 'No pricing information available.'}\n} ]\n```\n\n\n## Similar Projects\n\n- [Fahrplan.js](https://github.com/pbock/fahrplan) – \"A JavaScript client for Deutsche Bahn's timetable API\"\n- [db-prices](https://github.com/juliuste/db-prices) – Find the cheapest routes using the DB Sparpreise API.\n- [db-stations](https://github.com/derhuerst/db-stations) – An offline list of all DB stations.\n\nAlso check [`hafas-client`'s related projects](https://github.com/public-transport/hafas-client/blob/6/readme.md#related-projects).\n\n\n## Contributing\n\nIf you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/public-transport/db-hafas/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpublic-transport%2Fdb-hafas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpublic-transport%2Fdb-hafas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpublic-transport%2Fdb-hafas/lists"}