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

@unirate/angular

v0.1.0

Published

Official Angular module for the UniRate currency-exchange API. UniRateModule.forRoot, provideUniRate, injectable UniRateService (Observable-based), and currencyRate / currencyConvert pipes. Zero runtime deps.

Readme

@unirate/angular

Official Angular module for the UniRate API — free currency exchange rates, historical data, and VAT rates.

  • Observable-based UniRateService with full API parity
  • UniRateModule.forRoot() for NgModule apps
  • provideUniRate() for standalone Angular 16+ apps
  • currencyRate and currencyConvert pipes (use with Angular's built-in async pipe)
  • Zero runtime dependencies (peer deps: @angular/core, @angular/common, rxjs)
  • Compiled with ng-packagr in Angular Package Format (APF) — AOT and Ivy compatible

Install

npm install @unirate/angular

Requires Angular 16–22 and RxJS 7.

Quick start

Standalone app (app.config.ts)

import { provideUniRate } from '@unirate/angular';

export const appConfig: ApplicationConfig = {
  providers: [
    provideUniRate({ apiKey: environment.UNIRATE_API_KEY }),
  ],
};

NgModule app (app.module.ts)

import { UniRateModule } from '@unirate/angular';

@NgModule({
  imports: [
    UniRateModule.forRoot({ apiKey: environment.UNIRATE_API_KEY }),
  ],
})
export class AppModule {}

Inject the service

import { Component, inject, OnInit } from '@angular/core';
import { AsyncPipe } from '@angular/common';
import { Observable } from 'rxjs';
import { UniRateService } from '@unirate/angular';

@Component({
  selector: 'app-rates',
  standalone: true,
  imports: [AsyncPipe],
  template: `<p>EUR: {{ rate$ | async }}</p>`,
})
export class RatesComponent implements OnInit {
  private rates = inject(UniRateService);
  rate$!: Observable<number>;

  ngOnInit() {
    this.rate$ = this.rates.getRate('USD', 'EUR');
  }
}

Use the pipes

// In a standalone component:
import { CurrencyRatePipe, CurrencyConvertPipe } from '@unirate/angular';

@Component({
  standalone: true,
  imports: [AsyncPipe, CurrencyRatePipe, CurrencyConvertPipe],
  template: `
    <p>1 USD = {{ 'USD' | currencyRate:'EUR' | async }} EUR</p>
    <p>100 USD = {{ 100 | currencyConvert:'USD':'EUR' | async }} EUR</p>
  `,
})

Or add UniRateModule to imports in an NgModule to get the pipes automatically.

Async config (forRootAsync)

UniRateModule.forRootAsync({
  useFactory: (config: ConfigService) => ({
    apiKey: config.getOrThrow('UNIRATE_API_KEY'),
  }),
  deps: [ConfigService],
})

API

UniRateService

All methods return Observable<T>. Subscribe with Angular's async pipe or firstValueFrom().

getRate(from: string, to: string): Observable<number>
getRate(from: string): Observable<Record<string, number>>

convert(to: string, amount: number, from: string): Observable<number>

listCurrencies(): Observable<string[]>

// Pro-gated — returns 403 on the free tier
getHistoricalRate(date: string, amount: number, from: string, to: string): Observable<number>
getHistoricalRate(date: string, amount: number, from: string): Observable<Record<string, number>>
getHistoricalRates(date: string, amount: number, base: string): Observable<Record<string, number>>
convertHistorical(amount: number, from: string, to: string, date: string): Observable<number>
getTimeSeries(startDate: string, endDate: string, amount: number, base: string, currencies?: string[]): Observable<Record<string, Record<string, number>>>
getHistoricalLimits(): Observable<HistoricalLimitsResponse>
getVATRates(): Observable<VATRatesAll>
getVATRates(country: string): Observable<VATRateOne>

Raw Promise-based access: service.raw.getRate(...) returns a Promise<T> from the underlying UniRateClient.

Error handling

All errors extend UniRateError:

| Class | HTTP status | |---|---| | AuthenticationError | 401 | | ProRequiredError | 403 | | InvalidCurrencyError | 404 | | InvalidRequestError | 400 | | RateLimitError | 429 | | UniRateError | other / network |

import { catchError } from 'rxjs/operators';
import { UniRateError, ProRequiredError } from '@unirate/angular';

this.rates.getHistoricalRate('2023-01-01', 1, 'USD', 'EUR').pipe(
  catchError((err: UniRateError) => {
    if (err instanceof ProRequiredError) {
      console.warn('Historical rates require a Pro plan.');
    }
    throw err;
  }),
).subscribe();

Rate limits

The free plan allows 1,000 requests/month. Historical endpoints (/api/historical/*) require a Pro subscription and return ProRequiredError on the free tier.

Related clients

| Ecosystem | Package | |---|---| | Python | unirate-api | | Node.js | unirate-api | | React | @unirate/react | | Vue | @unirate/vue | | Next.js | @unirate/next | | SvelteKit | @unirate/sveltekit | | NestJS | @unirate/nestjs | | Nuxt | @unirate/nuxt | | Remix | @unirate/remix | | Eleventy | @unirate/eleventy | | Astro | @unirate/astro | | Go | unirate-api-go | | Rust | unirate-api | | Swift | unirate-api-swift | | MCP Server | @unirate/mcp |

License

MIT — see LICENSE.