|
|
|
|
|
by eadz
1232 days ago
|
|
I'm not convinced by the seperate DB/API. Advantages for using Postgres ( assuming a double entry schema[1] ) and you're using Postgres for your main app db; - You can do financial transactions inside business db transactions, and roll back both atomically
- Adding up numbers is one of the things computers are best at, and Postgres can easily handle a huge amount of financial transactions
- Re-use PaaS Postgres hosting/scaling/clustering/backups
- Easier integration with the rest of your app with foreign keys to relevant records relating to the financial transaction
- Easy integration with BI tools given Postgres is well connectable
[1]
Roughy `account(id, cached_balance)`, `transaction_lines(src_account, dst_account, amount)`This gem does literally billions of dollars worth of financial accounting for various companies at scale: https://github.com/envato/double_entry It's dated, the API is a bit messy and needs work, as it was initially written 10+ years ago, but for a web based app I would choose a v2 of it over a non-postgres ( assuming you are using Postgres for your app ) solution. |
|
https://blog.journalize.io/posts/an-elegant-db-schema-for-do...
I hadn't seen that gem before! My comment on most accounting tools is that they ignore the concept of "normal" account balances, which means they don't really think about "debits" and "credits". This is fine mathematically, of course, but makes it awfully difficult for accountants to understand how the software is supposed to behave!
We're running on mid-sized Postgres right now, but find that clickhouse (or duckdb) are something like 100x faster once we do GROUP BYs on 5M+ rows.