@finopsbricks/tally-sync
v0.5.0
Published
Local agent that mirrors TallyPrime companies into SQLite and shows them in a local web UI
Readme
tally-sync
@finopsbricks/tally-sync is a local agent for FinOpsBricks that runs on the Windows PC next to TallyPrime. It mirrors every loaded Tally company into local SQLite, shows the data and its sync health in a local web UI, and posts approved entries back to Tally. It is the only FinOpsBricks software that talks to Tally.
Status: early. tally-sync probe checks how your Tally answers, tally-sync sync mirrors your companies into SQLite, and tally-sync web shows them in your browser. All of them only read from Tally.
Install
Needs Node.js 22.13 or later.
On the Tally PC, follow Install on Windows: install, probe, first sync, and keeping it running with pm2.
For development on a Mac or Linux machine, reaching Tally on another PC through a tunnel, follow Install on Mac or Linux.
npm install -g @finopsbricks/tally-syncLet Tally answer requests
In TallyPrime: F1 (Help) → Settings → Connectivity → Client/Server configuration. Set TallyPrime acts as to Server (or Both) and the port to 9000. Load the companies you want to read.
Probe Tally
tally-sync probeIt asks Tally a fixed set of read-only questions:
- which companies are loaded;
- for each one: its ID, dates and change counters;
- every master table (groups, ledgers, voucher types, cost centres, opening bills);
- voucher counts per day;
- the last week of vouchers, with their ledger lines and bill, bank and cost-centre allocations.
It prints one line per step and saves every question and answer to one file, in %USERPROFILE%\.fob\tally-sync\probes\ on Windows (~/.fob/tally-sync/probes/ elsewhere).
The file contains data from your Tally books. Read it before you share it.
Options:
| Option | Does |
|---|---|
| --company "<name>" | Probe only this company (its exact name in Tally) |
| --host, --port | Where Tally listens (default localhost:9000) |
| --out <dir> | Where to save the probe file |
| --debug | Also log every exchange to <config dir>/logs/ |
| --config-dir <dir> | Config, data and logs directory (default ~/.fob/tally-sync) |
Sync
tally-sync sync --onceMirrors every loaded company into its own SQLite file in ~/.fob/tally-sync/data/ (one file per company, named by its Tally ID), then checks every ledger's balance against Tally's own closing balance. Without --once it keeps running and syncs every 5 minutes, skipping companies Tally reports no change for.
| Option | Does |
|---|---|
| --once | One pass, then exit |
| --company "<name>" | Sync only this company |
| --force | Sync even when Tally reports no change |
| --debug | Log every exchange with Tally to <config dir>/logs/ |
A sync that fails its checks (counts that don't add up, vouchers pulled twice, lines that don't balance) leaves the previous mirror as it was.
See it in the browser
tally-sync webOpen http://127.0.0.1:7780. The page is served on this PC only: other machines on the network can't reach it.
Keep it running with pm2
npm install -g pm2
tally-sync paths
pm2 start "<pm2_file from tally-sync paths>"
pm2 saveThis starts two processes: tally-sync (syncs every 5 minutes) and tally-sync-web (the page). pm2 logs tally-sync shows what each sync did.
Config
tally-sync config show
tally-sync config set tally.port 9001config set writes ~/.fob/tally-sync/config.yml (creating it the first time). Settings: tally.host, tally.port, tally.url, tally.cf_access_client_id, tally.cf_access_client_secret, tally.timeout_seconds, sync.interval_minutes, sync.batch_size, web.port, cloud.url. The file looks like:
tally:
host: localhost
port: 9000
timeout_seconds: 1800
web:
port: 7780
sync:
interval_minutes: 5
batch_size: 5000 # most vouchers asked for in one requestLink to tally.finopsbricks.com
tally-sync link
tally-sync link statuslink prints a code and a URL. A person signed in to tally.finopsbricks.com opens it, enters the code and picks the org each company belongs to. Only linked companies leave the PC. The agent's device token is saved in config.yml, which is then kept readable by its owner only.
From then on, after every pass sync reports how Tally is doing, and sends each linked company's mirror file, gzipped, when it holds a sync tally.finopsbricks.com doesn't have yet. If the upload fails, the mirror is unaffected and the file is sent again on the next pass. link status shows the sync the cloud held of each company at the last pass. Run link again to link a company added later.
Develop
npm install
npm testTests run against a fake Tally (tests/fakeTally/). To run against a real TallyPrime on another PC, see Develop through ngrok or Develop through Cloudflare Tunnel. Design notes are in docs/architecture/; work in progress is in docs/wip/.
Licence
Apache-2.0. Parts come from MIT-licensed open-source Tally projects; see NOTICE.
