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

directus-extension-unirate

v0.1.0

Published

Directus bundle for the UniRate currency-exchange API: an /unirate REST endpoint that keeps your API key server-side, plus a 'UniRate Currency' Flow operation to convert amounts, fetch rates, and list currencies. Zero runtime deps.

Readme

directus-extension-unirate

npm CI license

A Directus extension bundle for the UniRate currency-exchange API. It adds two things to your Directus instance:

  1. /unirate REST endpoint — proxies UniRate from your Directus server so the API key never reaches the browser. Hand your frontend /unirate/convert?to=EUR&amount=100 instead of exposing a key.
  2. "UniRate Currency" Flow operation — a no-code Flows node that converts an amount, fetches a rate, or lists supported currencies inside any automation.

Zero runtime dependencies — pure native fetch. The API key lives only in your Directus environment.


Install

From the Directus Marketplace

In your Directus project, open Settings → Marketplace, search for UniRate, and install. (Marketplace availability depends on your hosting: self-hosted instances can install any extension; Directus Cloud lists sandboxed/registry extensions.)

Manually (self-hosted)

npm install directus-extension-unirate

Directus auto-discovers extensions in node_modules whose name starts with directus-extension-. Restart Directus after installing.

Configure the API key

Set the key in your Directus environment (.env, Docker env, etc.):

UNIRATE_API_KEY=your_key_here
# optional override (defaults to https://api.unirateapi.com)
# UNIRATE_API_BASE_URL=https://api.unirateapi.com

EXTENSION_UNIRATE_API_KEY is also accepted. Get a free key at unirateapi.com.


The /unirate endpoint

All routes are GET, return JSON, and keep your key server-side. They are mounted under /unirate on your Directus API.

| Route | Query params | Returns | |---|---|---| | /unirate/rates | from (default USD), to (optional) | { from, to, rate } or { from, rates } | | /unirate/convert | to (required), from (default USD), amount (default 1) | { from, to, amount, result } | | /unirate/currencies | — | { currencies: [...] } | | /unirate/vat | country (optional, ISO-3166 alpha-2) | UniRate VAT payload | | /unirate/historical | date (required, YYYY-MM-DD), from, to, amount | historical rate/result — Pro-gated |

# single rate
curl 'https://your-directus.example.com/unirate/rates?from=USD&to=EUR'
# → { "from": "USD", "to": "EUR", "rate": 0.92 }

# convert
curl 'https://your-directus.example.com/unirate/convert?to=JPY&amount=49.99'
# → { "from": "USD", "to": "JPY", "amount": 49.99, "result": 7847.1 }

# supported currencies
curl 'https://your-directus.example.com/unirate/currencies'
# → { "currencies": ["USD", "EUR", "GBP", ...] }

The /unirate/historical route requires a UniRate Pro plan. On the free tier it returns the upstream 403 unchanged.

Errors

Upstream UniRate errors are mapped to HTTP status + a JSON { "error": "..." } body: 400 invalid params, 401 bad/missing key, 403 Pro-only, 404 unknown currency, 429 rate-limited, 502 upstream/network failure. If the key is not configured the endpoint returns 503.


The "UniRate Currency" Flow operation

Add the UniRate Currency operation to any Flow. Configure:

  • OperationConvert amount, Get rate, or List currencies
  • From currency — ISO 4217 code (default USD)
  • To currency — ISO 4217 code (required for convert/rate)
  • Amount — number (used by convert, default 1)

The operation's result is written to its data key for downstream steps:

// Convert amount
{ "from": "USD", "to": "EUR", "amount": 100, "result": 92.0 }

// Get rate (with To)
{ "from": "USD", "to": "EUR", "rate": 0.92 }

// List currencies
{ "currencies": ["USD", "EUR", "GBP", ...] }

A missing key or an upstream failure throws, routing the Flow down its reject path so you can handle it (notify, retry, fall back).

Example uses: stamp a converted price_eur onto an item on create, post a daily FX snapshot to Slack, or validate a currency code against the live supported list.


Reusing the typed client

The bundle also exports the standalone, dependency-free TypeScript client used under the hood — handy in custom hooks or other extensions:

import { UniRateClient, ProRequiredError } from "directus-extension-unirate/client";

const client = new UniRateClient({ apiKey: process.env.UNIRATE_API_KEY! });
const eur = await client.convert("EUR", 100, "USD");

Security

  • The UniRate API key is read only from the Directus server environment and is never sent to the browser or included in any response.
  • The package ships zero runtime dependencies (native fetch), built with plain tsc — no bundler/transpiler tree pulled into your install.
  • Published to npm with provenance (npm attestations).

Development

npm install
npm run typecheck
npm test          # vitest mock suite
npm run build     # tsc → dist/

CI runs typecheck + tests + build on Node 20 and 22.


Other UniRate clients

UniRate ships official client libraries and framework integrations across the ecosystem. The repos below are all maintained under the UniRate-API org.

Get a free API key at unirateapi.com.

License

MIT © 2026 UniRate API