npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

swiss-apis-cli

v1.0.0

Published

CLI for Swiss public APIs: transport, geo.admin.ch, opendata.swiss, Fedlex, OpenParlData, and more

Readme

swiss-apis-cli

Command-line interface to query Swiss public data and open APIs from the terminal. Commands are named with a swiss_* prefix (for example swiss_transport_connections, swiss_geo_get_elevation). Run swiss list to see every command and a short description.

Runtime: Node.js 18+.

What it talks to

The CLI calls (or points to) the services below. Availability, rate limits, and terms of use are defined by each operator—not by this project.

| Domain | Service | Role in the CLI | |--------|---------|------------------| | Public transport | transport.opendata.ch (/v1) | Station boards, connections, station/location search. | | Public transport (real-time) | OpenTransportData Swiss | GTFS real-time feeds via api.opentransportdata.swiss (API key required). | | Maps & geodesy | swisstopo / geo.admin.ch | api3.geo.admin.ch — search, identify canton/municipality, elevation; geodesy.geo.admin.ch/reframe — coordinate transforms; wmts.geo.admin.ch — WMTS tile URL helpers. | | Open government data | opendata.swiss CKAN API | ckan.opendata.swiss/api/3/action — dataset search for health (BAG), energy, MeteoSwiss-related datasets, BFS statistics, SNB, SEM migration, etc. | | Federal law | Fedlex | SPARQL endpoint fedlex.data.admin.ch/sparqlendpoint for in-force legislation search. | | Parliament | OpenParlData CH | api.openparldata.ch — search and person listings. | | Electricity grid | Swissgrid (open data) | Energy datasets and references surfaced via CKAN / Swissgrid-related queries in the CLI. | | Hydrology | hydrodaten.admin.ch | Hydrological data; linked open data via environment.ld.admin.ch (LINDAS) where applicable. | | Avalanches / snow | SLF | Avalanche and snow-related open data (often via opendata.swiss CKAN). | | Weather | MeteoSwiss open data | Datasets catalogued on opendata.swiss. | | Health | BAG / FOPH datasets on opendata.swiss; Versorgungsatlas | CKAN search and dataset metadata; atlas references where implemented. | | Postal & places | OpenPLZ API | openplzapi.org/ch — localities, postal codes (no API key). | | National Bank | data.snb.ch | SNB datasets on opendata.swiss plus API endpoint data.snb.ch/api in responses. | | Commercial register | ZEFIX | ZefixPublicREST — company search and related calls (account required). | | Food products | FoodRepo | foodrepo.org/api/v3 — product search (API token). | | Food composition | Nährwertdaten (FSVO) | The swiss_food_nutrition_database command returns links and hints to the official portal; it does not scrape or call a separate JSON API. | | Migration statistics | SEM | SEM statistics portal links plus SEM datasets via opendata.swiss CKAN. |

Install

npm install -g swiss-apis-cli

From a clone, run npm install && npm run build, then node dist/cli.js or use npm run dev with tsx.

Configuration

  1. Optional .env in the current working directory when you run swiss — copy .env.example to .env and set only what you need. Comments in .env.example link to official registration pages.
  2. Optional key file: ~/.swiss-apis-cli/keys (lines KEY=value). Values are merged into the process environment if not already set.

Variables used by the CLI:

| Variable | Used for | |----------|----------| | OTD_API_KEY | GTFS real-time / OpenTransportData Swiss | | ZEFIX_USER, ZEFIX_PASS | ZEFIX REST API | | FOODREPO_API_KEY | FoodRepo product API |

Usage

swiss list
swiss list --json

swiss info swiss_transport_stationboard

swiss call swiss_transport_stationboard '{"station":"Bern","limit":3}'
echo '{"from":"Bern","to":"Genève"}' | swiss call swiss_transport_connections -
swiss call swiss_geo_get_elevation @args.json

swiss doctor    # same as swiss call swiss_check_setup

swiss check_setup (and swiss doctor) summarizes which optional credentials are present—without printing secret values.

Tests

  • npm test — fast tests, no network (registry, validation, local swiss_check_setup behaviour).
  • npm run test:integrationlive HTTP against the public services above. Requires internet; may fail if an upstream API is down or has changed.
  • npm run test:all — runs both.

Some integration cases are skipped unless OTD_API_KEY, ZEFIX_*, or FOODREPO_API_KEY are set.

Licence

MIT — see LICENSE.