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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@x47base/ch-finance-engine

v1.0.2-beta2

Published

This package is an finance and accounting engine specificly made based on the swiss system.

Downloads

44

Readme


ch-finance-engine

Table of Contents

  1. Introduction
  2. Installation
  3. Usage
  4. Documentation
  5. License

Introduction

ch-finance-engine is a Node.js package designed for Swiss-style accounting and finance operations. It enables double-entry bookkeeping, currency conversions, and transaction management while maintaining compliance with Swiss accounting standards.

Features

  • Double-entry bookkeeping (Soll/Haben)
  • Multi-currency support with configurable exchange rates
  • Year-end closure of books and account management
  • Supports multiple transaction types: Buchung, Sammelbuchung, Splitsammelbuchung, Rückbuchung
  • Extensive unit tests for reliability

Installation

To install the latest version, run:

npm install @x47base/[email protected]

Usage

Basic Example

const { Engine } = require("@x47base/ch-finance-engine");

function demo() {
  const engine = new Engine("standard-config");
  
  // Create a Book for 2025
  const book2025 = engine.createBook(2025);

  // Create Accounts
  const bankAccount = engine.createAccount("Aktiv", 1000, "Bank", ["BankKonto"], 5000.0);
  const liabilities = engine.createAccount("Passiv", 2000, "Verbindlichkeiten L+L", ["Kreditoren"], 0.0);
  
  // Add to Book
  book2025.addAccount(bankAccount);
  book2025.addAccount(liabilities);

  // Perform a double-entry posting (Buchung)
  engine.performBuchung(1, bankAccount.code, liabilities.code, 500, "CHF", "Initial Payment");

  console.log(JSON.stringify(engine.toJSON(), null, 2));
}

demo();

Example with Template Accounts

const { Engine } = require("@x47base/ch-finance-engine");

function demoWithTemplateAccounts() {
  const engine = new Engine("standard-config");

  // Load template accounts
  engine.loadTemplateAccounts();

  // Create a Book for 2025
  const book2025 = engine.createBook(2025);

  // Get Accounts
  const bankAccount = engine.getAccountByCode(1000); // Kasse
  const liabilities = engine.getAccountByCode(2000); // Verbindlichkeiten aus Lieferungen und Leistungen

  // Add to Book
  book2025.addAccount(bankAccount);
  book2025.addAccount(liabilities);

  // Perform a double-entry posting (Buchung)
  engine.performBuchung(1, bankAccount.code, liabilities.code, 500, "CHF", "Initial Payment");

  console.log(JSON.stringify(engine.toJSON(), null, 2));
}

demoWithTemplateAccounts();

Documentation

Engine Class

new Engine(configFile: string = "standard-config")

Creates an engine instance using the specified configuration file.

createBook(year: number)

Creates a new accounting book for the specified year.

createAccount(type: "Aktiv"|"Passiv"|"Aufwand"|"Ertrag", code: number, name: string, aliases: Array<string>, balance: number)

Creates an account with the given parameters.

performBuchung(id: number, accountSoll: number, accountHaben: number, amount: number, currency: string, description: string)

Performs a double-entry transaction between two accounts.

toJSON()

Returns the entire engine state as a JSON object.


License

This project is licensed under a modified MIT license. The author retains the right to modify the license terms in future versions.