
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@classytic/ledger
Advanced tools
Production-grade double-entry accounting engine for MongoDB — schemas, reports, tax, multi-tenant
Embeddable double-entry accounting engine for MongoDB. Integer-cents arithmetic, plugin-based, country-agnostic.
Build QuickBooks, Xero, or TaxCycle-grade apps — the engine handles the accounting, you handle the UX.
npm install @classytic/ledger @classytic/mongokit mongoose
npm install @classytic/ledger-ca # Canada (GIFI, GST/HST, CRA)
npm install @classytic/ledger-bd # Bangladesh (BFRS, VAT/TDS, Mushak)
import { createAccountingEngine } from '@classytic/ledger';
import { canadaPack } from '@classytic/ledger-ca';
const accounting = createAccountingEngine({
country: canadaPack,
currency: 'CAD',
multiTenant: { orgField: 'organization', orgRef: 'Organization' },
});
// Schemas
const Account = mongoose.model('Account', accounting.createAccountSchema());
const JournalEntry = mongoose.model('JournalEntry', accounting.createJournalEntrySchema('Account'));
const FiscalPeriod = mongoose.model('FiscalPeriod', accounting.createFiscalPeriodSchema());
// Reports
const reports = accounting.createReports({ Account, JournalEntry });
const bs = await reports.balanceSheet({ organizationId, dateOption: 'year', dateValue: 2025 });
Accounting Engine
10 Reports
Plugins
doubleEntryPlugin — validates debits = credits, account existence, tenant integrityfiscalLockPlugin — prevents posting to closed fiscal periodsdateLockPlugin — blocks entries before a configurable lock datetaxHookPlugin — auto-generates tax lines via user-defined TaxLineGeneratoridempotencyPlugin — prevents duplicate entries by keyUtilities
Money — cents arithmetic, tax splitting, allocation with zero-sum guaranteebuildDimensionFields — schema helpers for analytic dimensionssuggestMatches — reconciliation matching suggestionscomputeRevaluation — FX gain/loss computationcreateAccountingEngine({
country: canadaPack, // required
currency: 'CAD', // required — base/functional currency
multiTenant: { orgField, orgRef }, // optional — multi-tenant scoping
multiCurrency: { enabled: true, currencies: ['USD', 'EUR'] },
fiscalYearStartMonth: 1, // 1=Jan (default), 4=Apr, 7=Jul
retainedEarningsAccountCode: '3600', // overrides country pack
audit: { trackActor: true },
idempotency: true,
strictness: {
immutable: true, // disable unpost, corrections via reverse only
requireActor: true, // actorId required on post/reverse
requireApproval: true // entries must be approved before posting
},
});
const reports = accounting.createReports({ Account, JournalEntry, Budget });
// All reports accept: { organizationId, dateOption, dateValue, filters? }
await reports.trialBalance({ ... });
await reports.balanceSheet({ ... });
await reports.incomeStatement({ ... });
await reports.generalLedger({ ... });
await reports.cashFlow({ ... });
await reports.agedBalance({ type: 'receivable', asOfDate: new Date() });
await reports.budgetVsActual({ ... }); // requires Budget model
await reports.dimensionBreakdown({ dimension: 'departmentId', ... });
await reports.revaluation({ rates: [{ currency: 'USD', rate: 1.40 }], ... });
All report data is sorted by account code. All monetary values are integer cents — use Money.toDecimal() at your API boundary.
accounting.createAccountSchema(options?)
accounting.createJournalEntrySchema(accountModelName, {
extraItemFields: { departmentId: { type: ObjectId, ref: 'Department' } },
})
accounting.createFiscalPeriodSchema(options?)
accounting.createBudgetSchema(options?)
accounting.createReconciliationSchema(accountModelName, journalEntryModelName, options?)
import { dateLockPlugin, taxHookPlugin } from '@classytic/ledger';
// Date lock — block posting before a date
dateLockPlugin({
getLockDate: async (orgId) => db.getOrgLockDate(orgId),
JournalEntryModel,
});
// Tax hook — auto-generate tax lines
taxHookPlugin({
generator: {
generateTaxLines(input) {
if (!input.taxCode) return [];
const tax = Money.percentage(input.amount, 1300); // 13%
return [{ account: hstAccountId, debit: 0, credit: tax, taxDetails: [{ taxCode: 'HST' }] }];
},
},
});
| Path | Contents |
|---|---|
@classytic/ledger | Engine, Money, all schemas, plugins, reports, types |
@classytic/ledger/money | Money class |
@classytic/ledger/schemas | Schema factories |
@classytic/ledger/reports | Report generators |
@classytic/ledger/plugins | All plugins |
@classytic/ledger/repositories | Repository wiring |
@classytic/ledger/exports | CSV export + QuickBooks field maps |
@classytic/ledger/country | defineCountryPack, CountryPack interface |
@classytic/ledger/constants | Categories, journal types, currencies |
Build your own or use an existing one:
import { defineCountryPack } from '@classytic/ledger';
export const myPack = defineCountryPack({
code: 'US',
name: 'United States',
defaultCurrency: 'USD',
retainedEarningsAccountCode: '3200',
accountTypes: [ /* your chart of accounts */ ],
taxCodes: { /* your tax codes */ },
taxCodesByRegion: {},
regions: [],
});
Available packs: @classytic/ledger-ca (Canada), @classytic/ledger-bd (Bangladesh).
949 tests covering unit, integration, and end-to-end scenarios:
npm test # run all
npx vitest run tests/e2e/ # e2e scenarios only
E2E suites include:
MIT
FAQs
Production-grade double-entry accounting engine for MongoDB — schemas, reports, tax, multi-tenant
We found that @classytic/ledger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.