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

open-koleo

v1.0.3-scu.1

Published

An unofficial API wrapper for Koleo.pl - a Polish railway connection search platform

Readme

OpenKoleo (koleo)

License: MIT npm version Tests

A robust, unofficial Node.js wrapper for the Koleo.pl API by VEX Systems. Provides a comprehensive interface for searching connections, stations, brands, and discounts with built-in validation and type safety.

Note: This library is not affiliated with Koleo.pl or PKP. Use it responsibly.

Features

  • 🚆 Search Connections: Find train connections between stations with prices and details.
  • 🚉 Stations: Search stations by name, slug, city, or region.
  • 👤 User Account: Authenticate users and retrieve profile data, tickets, and passenger info.
  • 🎫 Brands & Discounts: Retrieve available train operators and discount types.
  • 🛠️ Utilities: Built-in helpers for slug conversion and validation.

Installation

npm install open-koleo

Usage

import Koleo from 'open-koleo';

const client = new Koleo();

// Find a connection
const connections = await client.connections.findConnection(
    'Warszawa Centralna',
    'Kraków Główny',
    client.types.DEP_DATE.now
);
console.log(connections);

// Search for a station
const stations = await client.stations.findStationsByName('Gdańsk');
console.log(stations);

Documentation

Detailed API documentation is available in docs/API.md.

Modules

The library is structured into modules accessible via the main Koleo instance.

stations

  • getAllStations(): Returns all available stations.
  • findStationsByName(name): Live search for stations by name.
  • getBySlug(slug): Get detailed station info by its slug.
  • getByName(name): Get detailed station info by exact name.
  • getStationsByCity(city): Filter stations by city.
  • getStationsByRegion(region): Filter stations by region.
  • getStationInfoByID(id): Get station details by ID.
  • getStationsInfoByIDs(ids): Get details for multiple stations by IDs.

user

  • performLogin(email, password): Authenticate and get access token.
  • getMe(accessToken): Get user profile.
  • getPassangers(accessToken): Get saved passengers.
  • getActiveTickets(accessToken): Get active tickets.
  • getInactiveTickets(accessToken, page, per_page): Get past tickets.
  • getTransactionHistory(accessToken): Get wallet history.

connections

  • findConnection(from, to, date, onlyDirect): Search for connections.
  • getConnectionInfo(id): Get details of a specific connection.
  • getConnectionTicketPrice(id): Get price information.

brands

  • getBrands(): List all train brands/operators.

discounts

  • getDiscounts(): List all available discounts.
  • getDiscountCards(age): Get available discount cards.

converters

  • nameToSlug(name, validate): Convert station name to Koleo slug. Optional validation against API.

types

  • DEP_DATE.now: Returns current date in format required by API (YYYY-MM-DDTHH:MM:SS).
  • KREGEX.connection_id: Regex pattern for validating connection IDs.
  • IDENTITY_CARD_TYPES: List of supported identity card types.

Error Handling

The API wrapper returns structured error objects when operations fail. Common error codes include:

  • stationNotFound: The requested station could not be found.
  • slugConversionFailed: Failed to convert a station name to a valid Koleo slug.
  • stationsNotFound: One or both stations in a connection search could not be resolved.
  • noConnectionsFound: No connections were found for the given criteria.
  • brandsNotFound: Failed to retrieve the list of brands.
  • discountsNotFound: Failed to retrieve the list of discounts.
  • couldNotObtainAccessToken: Failed to login (e.g., invalid credentials).
  • invalidAccessToken: The provided access token is invalid or expired.
  • discountCardsNotFound: Failed to retrieve the list of discount cards.

Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

Distributed under the MIT License. See LICENSE for more information.