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

frankfurter-api-client

v1.2.2

Published

A lightweight, dependency-minimal TypeScript client for the Frankfurter API, providing easy access to latest, historical, and time-series currency exchange rates.

Readme

banner-5 npm downloads license

Frankfurter API Client

A lightweight, type-safe JavaScript/TypeScript client for the Frankfurter Currency Exchange Rates API, designed for developers who want clean abstractions, strong date validation, and a minimal API surface. This package wraps the Frankfurter API with strict input validation, predictable error handling, and zero runtime configuration.

📦 Installation

npm install frankfurter-api-client

Note: This client is powered by the official Frankfurter API. No API Keys are required.

📘 Features

  1. TypeScript-first with full type definitions
  2. Strict date validation (including leap years & future dates)
  3. Supports historical rates and time-series queries
  4. Minimal dependencies: dayjs only
  5. Clean, promise-based API - Works in both Node.js and modern browsers

🔤 Example Usage

  1. Get Latest Exchange Rates
import { getLatestRates } from 'frankfurter-api-client';

const response = await getLatestRates({
  base: 'EUR',
  symbols: ['USD', 'INR'] /* symbols part in the input props is optional */,
});

/*
{
  base: "EUR",
  date: "2025-01-10",
  rates: {
    USD: 1.09,
    INR: 90.42,
    ...
  }
}
*/
  1. Get Historical Rates for a Specific Date
import { getHistoricalRatesForDate } from 'frankfurter-api-client';

const data = await getHistoricalRatesForDate({
  base: 'USD',
  symbols: ['EUR', 'GBP'] /* symbols part in the input props is optional */,
  period: {
    year: 2023,
    month: 10 /* 1 (Jan) ... 12 (Dec), not indexed value */,
    date: 12 /* range between 1 and 31 */,
  },
});

/*
{
  base: "USD",
  date: "2023-10-12",
  rates: {
    EUR: 0.94,
    GBP: 0.82,
    ...
  }
}
*/
  1. Get Time Series Rates Between Two Dates
import { getTimeSeriesRates } from 'frankfurter-api-client';

const data = await getTimeSeriesRates({
  base: 'EUR',
  symbols: ['USD'] /* symbols part in the input props is optional */,
  start: {
    year: 2023,
    month: 1 /* 1 (Jan) ... 12 (Dec), not indexed value */,
    date: 1 /* range between 1 and 31 */,
  },
  end: {
    year: 2023,
    month: 1 /* 1 (Jan) ... 12 (Dec), not indexed value */,
    date: 5 /* range between 1 and 31 */,
  },
});

/*
{
  base: "EUR",
  start_date: "2023-01-01",
  end_date: "2023-01-05",
  rates: {
    "2023-01-01": { USD: 1.07 },
    "2023-01-02": { USD: 1.06 },
    "2023-01-03": { USD: 1.05 }
    ...
    ...
  }
}
*/
  1. Get Supported Currencies
import { getSupportedCurrencies } from 'frankfurter-api-client';
const data = await getSupportedCurrencies(); /* no input props required */
/*
{
  USD: "United States Dollar",
  EUR: "Euro",
  GBP: "British Pound Sterling",
  INR: "Indian Rupee",
  ...
  ...
}
*/

📗 Test Coverage

PASS src/get-supported-currencies/test/index.test.ts
  getSupportedCurrencies
    ✓ throws when fetch response is not ok
    ✓ returns payload when response ok
    ✓ targets the currencies endpoint

PASS src/get-latest-rates/test/index.test.ts
  getLatestRates
    ✓ throws when fetch response is not ok
    ✓ returns payload when response ok
    ✓ targets the latest rates endpoint with base only
    ✓ adds symbols when provided

PASS src/get-timeseries-rates/test/index.test.ts
  getTimeSeriesRates
    ✓ throws when start date is after end date
    ✓ throws when fetch response is not ok
    ✓ returns payload when response ok
    ✓ targets the timeseries endpoint with base only
    ✓ adds symbols when provided

PASS src/shared/test/index.test.ts
  shared
    ✓ API_ROOT points to frankfurter api base
  validateAndFormatDate
    ✓ returns YYYY-MM-DD for valid date
    ✓ throws for invalid year
    ✓ throws for invalid month
    ✓ throws for invalid date
    ✓ throws for date after today
    ✓ throws for future year

PASS src/get-historical-rates/test/index.test.ts
  getHistoricalRatesForDate
    ✓ throws when fetch response is not ok
    ✓ returns payload when response ok
    ✓ targets the historical endpoint with base only
    ✓ adds symbols when provided

Test Suites: 5 passed, 5 total
Tests:       23 passed, 23 total
Snapshots:   0 total
------------------------------|---------|----------|---------|---------|-------------------
File                          | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------------------------|---------|----------|---------|---------|-------------------
All files                     |   99.43 |    96.77 |     100 |   99.43 |
 get-historical-rates         |     100 |      100 |     100 |     100 |
  index.ts                    |     100 |      100 |     100 |     100 |
 get-latest-rates             |     100 |      100 |     100 |     100 |
  index.ts                    |     100 |      100 |     100 |     100 |
 get-supported-currencies     |     100 |      100 |     100 |     100 |
  index.ts                    |     100 |      100 |     100 |     100 |
 get-timeseries-rates         |     100 |      100 |     100 |     100 |
  index.ts                    |     100 |      100 |     100 |     100 |
 shared                       |    97.5 |     90.9 |     100 |    97.5 |
  index.ts                    |     100 |      100 |     100 |     100 |
  validate-and-format-date.ts |   97.43 |     90.9 |     100 |   97.43 | 29
------------------------------|---------|----------|---------|---------|-------------------

📘 Contributing

Contributions, suggestions, and improvements are welcome. Feel free to open issues or pull requests.

❤️ Support

Like this project? Support it with a github star, it would mean a lot to me! Cheers and Happy Coding.