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

ryanair-ts

v1.1.4

Published

TypeScript client for Ryanair flight search API

Readme

ryanair-ts

TypeScript client for the Ryanair flight search API.

This module allows you to retrieve the cheapest flights, with or without return flights, within a fixed set of dates.

This is done directly through Ryanair's API, and does not require an API key.

Disclaimer

DISCLAIMER: This library is not affiliated, endorsed, or sponsored by Ryanair or any of its affiliates. All trademarks related to Ryanair and its affiliates are owned by the relevant companies. The author(s) of this library assume no responsibility for any consequences resulting from the use of this library. The author(s) of this library also assume no liability for any damages, losses, or expenses that may arise from the use of this library. Any use of this library is entirely at the user's own risk. It is solely the user's responsibility to ensure compliance with Ryanair's terms of use and any applicable laws and regulations. The library is an independent project aimed at providing a convenient way to interact with the Ryanair API, allowing individuals to find flights for personal use, and then ultimately purchase them via Ryanair's website. While the author(s) will make efforts to ensure the library's functionality, they do not guarantee the accuracy, completeness, or timeliness of the information provided. The author(s) do not guarantee the availability or continuity of the library, and updates may not be guaranteed. Support for this library may be provided at the author(s)'s discretion, but it is not guaranteed. Users are encouraged to report any issues or feedback to the author(s) via appropriate channels. By using this library, users acknowledge that they have read, understood, and agreed to the terms of this disclaimer.

Installation

npm install ryanair-ts

Requirements

  • Node.js 18.0.0 or higher

Usage

Create an instance

import { Ryanair } from 'ryanair-ts';

// You can set a currency at the API instance level
// Note: this may not always be respected by the API, so always check the currency returned
const api = new Ryanair({ currency: 'EUR' });

Get the cheapest one-way flights

Get the cheapest flights from a given origin airport (returns at most 1 flight to each destination).

import { Ryanair } from 'ryanair-ts';

const api = new Ryanair({ currency: 'EUR' });

const flights = await api.getCheapestFlights({
  airport: 'DUB',
  dateFrom: '2024-03-01',
  dateTo: '2024-03-31',
});

// Returns an array of Flight objects
const flight = flights[0];
console.log(flight);
// {
//   departureTime: Date,
//   flightNumber: 'FR 9717',
//   price: 31.99,
//   currency: 'EUR',
//   origin: 'DUB',
//   originFull: 'Dublin, Ireland',
//   destination: 'GOA',
//   destinationFull: 'Genoa, Italy'
// }

console.log(flight.price); // 31.99

Get the cheapest return trips

import { Ryanair } from 'ryanair-ts';

const api = new Ryanair({ currency: 'EUR' });

const trips = await api.getCheapestReturnFlights({
  sourceAirport: 'DUB',
  dateFrom: '2024-03-01',
  dateTo: '2024-03-15',
  returnDateFrom: '2024-03-16',
  returnDateTo: '2024-03-31',
});

const trip = trips[0];
console.log(trip.totalPrice); // 85.31
console.log(trip.outbound.destination); // 'EMA'
console.log(trip.inbound.origin); // 'EMA'

Advanced options

Both search methods support additional filtering options:

const flights = await api.getCheapestFlights({
  airport: 'DUB',
  dateFrom: '2024-03-01',
  dateTo: '2024-03-31',
  destinationCountry: 'ES',          // Filter to Spain only
  destinationAirport: 'BCN',         // Or a specific airport
  departureTimeFrom: '08:00',        // Earliest departure time
  departureTimeTo: '20:00',          // Latest departure time
  maxPrice: 50,                      // Maximum price filter
  customParams: { limit: 10 },       // Additional API parameters
});

Airport utilities

Calculate distances between airports:

import { getDistanceBetweenAirports, getFlightDistance } from 'ryanair-ts';

// Get distance between two airports
const distance = await getDistanceBetweenAirports('DUB', 'BCN');
console.log(`Dublin to Barcelona: ${distance.toFixed(0)} km`);

// Or calculate distance for a flight
const flights = await api.getCheapestFlights({ ... });
const flightDistance = await getFlightDistance(flights[0]);

Configuration options

import { Ryanair } from 'ryanair-ts';

const api = new Ryanair({
  // Currency for prices
  currency: 'EUR',

  // Custom logger (defaults to console)
  logger: {
    debug: (msg) => console.debug(msg),
    info: (msg) => console.info(msg),
    warn: (msg) => console.warn(msg),
    error: (msg) => console.error(msg),
  },

  // Retry configuration
  retry: {
    maxRetries: 5,      // Maximum retry attempts
    baseDelay: 1000,    // Base delay in ms (doubles each retry)
    maxDelay: 30000,    // Maximum delay cap
    jitter: 0.1,        // Randomization factor
  },
});

API Reference

Ryanair

Main client class.

Constructor

new Ryanair(config?: RyanairConfig)

Methods

  • getCheapestFlights(options: OneWayFlightOptions): Promise<Flight[]>
  • getCheapestReturnFlights(options: ReturnFlightOptions): Promise<Trip[]>
  • numQueries: number - Read-only count of API queries made

Types

interface Flight {
  departureTime: Date;
  flightNumber: string;
  price: number;
  currency: string;
  origin: string;
  originFull: string;
  destination: string;
  destinationFull: string;
}

interface Trip {
  totalPrice: number;
  outbound: Flight;
  inbound: Flight;
}

License

MIT