@genkin/core
The foundation of Genkin. High-precision arithmetic with integer-based calculations, currency formatting, and generic numeric type support for maximum accuracy and performance.
@genkin/currencies
Complete ISO 4217 currency support with 180+ currencies. Type-safe currency codes, automatic formatting, and seamless integration with the currency registry.
Dinero.js Compatibility
Drop-in replacements for Dinero.js v1 and v2. Migrate existing projects effortlessly while gaining better performance and TypeScript support.
Why Choose Genkin?
Built for developers who demand precision and reliability in financial calculations
🔢 Perfect Precision
Integer-based arithmetic eliminates floating-point errors. Your calculations will always be accurate, no matter how complex.
🔄 Drop-in Compatible
Seamlessly migrate from Dinero.js v1 or v2. Keep your existing code while gaining better performance and TypeScript support.
âš¡ TypeScript First
Full type safety with excellent developer experience. Catch errors at compile time, not runtime.
Simple Yet Powerful
Genkin's API is intuitive and familiar, whether you're using the core package or migrating from Dinero.js. Here are some common patterns:
import { genkin, add, USD } from '@genkin/core';
const price = genkin(1999, { currency: USD }); // $19.99
const tax = genkin(299, { currency: USD }); // $2.99
const total = add(price, tax); // $22.98
console.log(total.toString()); // "$22.98"
// Before (Dinero.js v1)
import { Dinero } from 'dinero.js';
const amount = Dinero({ amount: 1000, currency: 'USD' });
// After (@genkin/dinero)
import { Dinero } from '@genkin/dinero';
import { USD } from '@genkin/currencies';
const amount = Dinero({ amount: 1000, currency: USD });
import { dinero, add } from '@genkin/dinero-v2';
// Works with BigInt for unlimited precision
const price = dinero({
amount: 1000000000n,
currency: USD,
scale: 2n
});
// Or with Big.js for decimal precision
const rate = dinero({
amount: new BigJs('1.0599'),
currency: USD,
scale: 4
});
Get Started in Minutes
Choose the packages that fit your needs
For New Projects
# Install core and currencies
bun add @genkin/core @genkin/currencies
Perfect for new applications requiring precise financial calculations.
Migrating from Dinero.js?
# For Dinero.js v1 projects
bun add @genkin/dinero @genkin/currencies
# For Dinero.js v2 projects
bun add @genkin/dinero-v2 @genkin/currencies
Drop-in replacements with enhanced performance and TypeScript support.