{"_id":"@allratestoday/live-currency-rates","name":"@allratestoday/live-currency-rates","dist-tags":{"latest":"1.1.2"},"versions":{"1.1.2":{"name":"@allratestoday/live-currency-rates","version":"1.1.2","description":"Convert currencies with live exchange rates. Fluent API: Convert(100).from('USD').to('EUR'). Multiple providers (free, no key by default) — Frankfurter, fawazahmed0, AllRatesToday. Zero dependencies.","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","test":"vitest run","test:watch":"vitest"},"keywords":["currency","currencies","currency-converter","currency-conversion","currency-exchange","exchange-rate","exchange-rates","converter","conversion","rates","live-rates","realtime","forex","money","finance","convert","usd","eur","gbp"],"author":{"name":"cahthuranag"},"license":"MIT","homepage":"https://cahthuranag.github.io/live-currency-converter/","repository":{"type":"git","url":"git+https://github.com/cahthuranag/live-currency-converter.git"},"bugs":{"url":"https://github.com/cahthuranag/live-currency-converter/issues"},"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","vitest":"^4.1.4"},"publishConfig":{"access":"public"},"_id":"@allratestoday/live-currency-rates@1.1.2","_nodeVersion":"22.22.1","_npmVersion":"9.2.0","dist":{"integrity":"sha512-JM767T7jg7+Wlp0gk77/9sa7E6NEVEl4IlVLEqM0cR/ised21w//JwYY5RG5nU4Bwu/cvBNdocE5TQiW0mbMOw==","shasum":"875ed2deb4a5eb9e9e93638be49b2a45f45fed83","tarball":"https://registry.npmjs.org/@allratestoday/live-currency-rates/-/live-currency-rates-1.1.2.tgz","fileCount":7,"unpackedSize":27207,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCZwLJeUUMax/HRi4QedBO14ZIgB0C4rr47+opULp63vQIgRlRbialigwSp4stkEJtgSg0SYV/1jP5lOcVmvB6tU8g="}]},"_npmUser":{"name":"chathurangac8","email":"basnayakac8@gmail.com"},"directories":{},"maintainers":[{"name":"chathurangac8","email":"basnayakac8@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/live-currency-rates_1.1.2_1787947803668_0.6936768177749095"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-28T20:10:03.417Z","1.1.2":"2026-08-28T20:10:03.846Z","modified":"2026-08-28T20:10:04.444Z"},"maintainers":[{"name":"chathurangac8","email":"basnayakac8@gmail.com"}],"description":"Convert currencies with live exchange rates. Fluent API: Convert(100).from('USD').to('EUR'). Multiple providers (free, no key by default) — Frankfurter, fawazahmed0, AllRatesToday. Zero dependencies.","homepage":"https://cahthuranag.github.io/live-currency-converter/","keywords":["currency","currencies","currency-converter","currency-conversion","currency-exchange","exchange-rate","exchange-rates","converter","conversion","rates","live-rates","realtime","forex","money","finance","convert","usd","eur","gbp"],"repository":{"type":"git","url":"git+https://github.com/cahthuranag/live-currency-converter.git"},"author":{"name":"cahthuranag"},"bugs":{"url":"https://github.com/cahthuranag/live-currency-converter/issues"},"license":"MIT","readme":"> Scoped mirror of [`live-currency-rates`](https://www.npmjs.com/package/live-currency-rates) published by the AllRatesToday org — same code, same versions.\n\n# live-currency-rates\n\n[![Powered by AllRatesToday](https://img.shields.io/badge/Powered%20by-AllRatesToday-orange.svg)](https://allratestoday.com)\n\nConvert currencies with live exchange rates. Simple, fluent API. Multiple providers — use a free one (no key) or bring your own.\n\n[![npm](https://img.shields.io/npm/v/live-currency-rates?color=cb3837)](https://www.npmjs.com/package/live-currency-rates)\n[![zero dependencies](https://img.shields.io/badge/dependencies-0-brightgreen.svg)](https://www.npmjs.com/package/live-currency-rates)\n[![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.svg?v=101)](https://www.typescriptlang.org/)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\n## Install\n\n```bash\nnpm install @allratestoday/live-currency-rates\n```\n\n## Quick Start (no key)\n\n```typescript\nimport { Convert } from '@allratestoday/live-currency-rates';\n\nconst result = await Convert(100).from('USD').to('EUR');\nconsole.log(result.amount); // 92.45\n```\n\nBy default, the package uses the free **Frankfurter** provider (ECB data) — no signup, no API key.\n\n## Why live-currency-rates?\n\nMost popular \"currency\" packages do the **math** but make you fetch the **rates** yourself:\n\n| Package                   | Converts amounts | Fetches live rates          | No API key |\n| ------------------------- | :--------------: | :-------------------------: | :--------: |\n| **live-currency-rates**   |        ✅        |             ✅              |     ✅     |\n| cashify                   |        ✅        | ❌ you supply rates         |     —      |\n| money / money.js          |        ✅        | ❌ you supply rates         |     —      |\n| dinero.js / currency.js   |        ✅        | ❌ math/format only         |     —      |\n\nWith cashify or money.js you still have to find a rate source, fetch it, and keep it fresh. `live-currency-rates` does the fetch **and** the conversion in one call — and works with zero config out of the box.\n\n## Providers\n\nPick a provider based on your needs:\n\n| Provider      | Key?  | Currencies | Source                    | Notes                         |\n| ------------- | ----- | ---------- | ------------------------- | ----------------------------- |\n| `frankfurter` | no    | ~30        | European Central Bank     | Default. Daily updates.       |\n| `fawaz`       | no    | 200+       | fawazahmed0/currency-api  | Includes crypto. CDN-hosted.  |\n| `allrates`    | yes   | 160+       | AllRatesToday (Reuters)   | Real-time mid-market rates.   |\n\nChoose a provider with `setup()`:\n\n```typescript\nimport { setup, Convert } from '@allratestoday/live-currency-rates';\n\n// Free, no key — 200+ currencies including crypto\nsetup({ provider: 'fawaz' });\n\n// AllRatesToday — get a free key at https://allratestoday.com/register\nsetup({ apiKey: 'art_live_...' });\n```\n\n## API\n\n### `Convert(amount).from('XXX').to('YYY')`\n\n```typescript\nconst result = await Convert(250).from('GBP').to('JPY');\nconsole.log(`250 GBP = ${result.amount} JPY`);\nconsole.log(`Rate: ${result.rate}`);\n```\n\nReturns: `{ amount, rate, from, to, originalAmount }`\n\n### `Rate('XXX').to('YYY')`\n\n```typescript\nimport { Rate } from '@allratestoday/live-currency-rates';\n\nconst { rate } = await Rate('USD').to('EUR');\nconsole.log(`1 USD = ${rate} EUR`);\n```\n\n### `Rates('XXX', ['YYY', 'ZZZ'])`\n\n```typescript\nimport { Rates } from '@allratestoday/live-currency-rates';\n\nconst rates = await Rates('USD', ['EUR', 'GBP', 'JPY']);\n// { EUR: 0.92, GBP: 0.78, JPY: 149.5 }\n```\n\nOmit the target list to get all available rates for the base currency.\n\n### `Symbols()`\n\n```typescript\nimport { Symbols } from '@allratestoday/live-currency-rates';\n\nconst symbols = await Symbols();\n// { USD: 'United States Dollar', EUR: 'Euro', ... }\n```\n\n### `setup(config)`\n\n```typescript\nsetup({\n  provider: 'frankfurter' | 'fawaz' | 'allrates',\n  apiKey: 'art_live_...',   // only for provider: 'allrates'\n  baseUrl: '...',           // optional override\n  timeout: 10000,           // ms, default 10000\n});\n```\n\n## Recipes\n\n### React — show prices in the user's currency\n\n```tsx\nimport { useEffect, useState } from 'react';\nimport { Convert } from '@allratestoday/live-currency-rates';\n\nfunction Price({ usd, currency }: { usd: number; currency: string }) {\n  const [local, setLocal] = useState<number | null>(null);\n\n  useEffect(() => {\n    Convert(usd).from('USD').to(currency).then(r => setLocal(r.amount));\n  }, [usd, currency]);\n\n  return <span>{local == null ? '…' : `${local.toFixed(2)} ${currency}`}</span>;\n}\n```\n\n### Express — a convert endpoint\n\n```javascript\nconst express = require('express');\nconst { Convert } = require('@allratestoday/live-currency-rates');\n\nconst app = express();\n\n// GET /convert?amount=100&from=USD&to=EUR\napp.get('/convert', async (req, res) => {\n  const { amount, from, to } = req.query;\n  const result = await Convert(Number(amount)).from(from).to(to);\n  res.json(result);\n});\n\napp.listen(3000);\n```\n\n### Next.js — server-side rate in a Route Handler\n\n```typescript\nimport { Rate } from '@allratestoday/live-currency-rates';\n\nexport async function GET() {\n  const { rate } = await Rate('USD').to('EUR');\n  return Response.json({ usdEur: rate });\n}\n```\n\n## CommonJS\n\n```javascript\nconst { Convert } = require('@allratestoday/live-currency-rates');\n\nConvert(100).from('USD').to('EUR').then(r => console.log(r.amount));\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-e88a727beb5f78e7703e66653006f1bb"}