Trivio Logo
Official Monorepo SDKs

Modular SDK Architecture

Trivio is designed with strict boundaries: mathematical calculations stay completely isolated in our zero-dependency core engine, while dedicated packages provide server-side client helpers and accessible React UI components.

@trivio.ink/core

v0.1.0 Live

Zero-dependency, zero-float settlement calculation primitives and calendar shift engines.

Key Characteristics:

  • Zero Runtime Dependencies: Eliminates supply-chain risks and vendor lock-in.
  • Zero-Float Math: Integer minor currency units with BigInt intermediate precision.
  • Calendar Forecasting: Supports T+1 to T+30, cut-off windows, weekends, and holidays.
npm install @trivio.ink/core
@trivio.ink/core usagetypescript
import { 
  calculatePaymentSettlementEstimate, 
  estimateSettlementDate 
} from "@trivio.ink/core";

// 1. Calculate settlement estimate with MDR & fixed fee
const estimate = calculatePaymentSettlementEstimate({
  grossMinor: 500000n, // $5,000.00 in minor units
  feeRule: {
    percentageBps: 220, // 2.20%
    fixedFeeMinor: 30n,  // $0.30 fixed deduction
  },
  transactionTimeUtc: "2026-11-16T10:00:00Z",
});

console.log(estimate.netMinor); // 488970n ($4,889.70)
console.log(estimate.totalFeeMinor); // 11030n ($110.30)

@trivio.ink/node

v0.1.0 Live

Backend client foundation for Node.js services, microservices, and financial ledgers.

Key Characteristics:

  • TrivioClient: Configurable instance holding merchant fee rules and regional policies.
  • Crash-Free JSON Snapshots: Automatically serializes BigInt fields to string minor representations.
  • Framework-Decoupled: Works in Express, Fastify, NestJS, or serverless lambda functions.
npm install @trivio.ink/node
@trivio.ink/node usagetypescript
import { TrivioClient } from "@trivio.ink/node";

// 2. Server-side configured client for backend services
const client = new TrivioClient({
  defaultFeeRule: {
    id: "RULE_STANDARD_MDR",
    percentageBps: 290, // 2.90%
    fixedFeeMinor: 30n,  // $0.30
  },
  defaultSettlementPolicy: {
    id: "POLICY_T_PLUS_1",
    cycleDays: 1,
    cutOffTimeUtc: "16:00",
    weekendHandling: "NEXT_BUSINESS_DAY",
  },
});

// Calculate and generate BigInt-safe serializable ledger record
const record = client.createLedgerRecord({
  transactionId: "txn_987654321",
  grossMinor: 100000n,
  transactionTimeUtc: new Date().toISOString(),
});

// Safe for JSON.stringify without BigInt TypeError
const jsonString = JSON.stringify(record);

@trivio.ink/react

v0.1.0 Live

Accessible React components, monetary formatters, and settlement UI elements.

Key Characteristics:

  • Currency Exponent Safety: Correctly formats JPY (0 decimals), USD/EUR (2 decimals), and BHD (3 decimals).
  • Ready-to-Use UI: Pre-built breakdown cards, timeline badges, and estimate summary trees.
  • Design Token Integration: Uses Trivio's Midnight Navy and Electric Cyan theme tokens.
npm install @trivio.ink/react
@trivio.ink/react usagetypescript
import React from "react";
import { TrivioSettlementSummary, TrivioFeeBreakdown } from "@trivio.ink/react";

export function PayoutDetails({ estimate }) {
  return (
    <div className="space-y-4">
      {/* High-level gross, fees, and net settlement summary */}
      <TrivioSettlementSummary estimate={estimate} currency="USD" />
      
      {/* Itemized fee table with percentage and fixed breakdowns */}
      <TrivioFeeBreakdown 
        grossMinor={estimate.grossMinor}
        percentageBps={250}
        fixedFeeMinor={1500n}
        currency="USD"
      />
    </div>
  );
}