TigerBeetle Schema Wizard 🪲🪄

Backstory

Once in the whimsical world of DataOz, a place where semicolons frolicked and functions danced, there was a legendary accounting database known as TigerBeetle, the guardian of debits and credits. Like Dorothy in her quest for the Emerald City, our heroes—Alice the Analyst, Bob the Backend Dev, and Charlie the CPA—were on a quest to master this digital beast to balance their mystical ledgers. "If only we could speak 'TigerBeetlese'," sighed Alice, as they stared at a maze of numbers more perplexing than the riddles of the Sphinx.

Bob, ever the optimist despite once trying to use a sandwich as a floppy disk, chimed in, "Fear not, for legend speaks of the TigerBeetle Schema Wizard, a being who can conjure a robot so smart, it would turn our business logic into TigerBeetle treats!" Off they went, down the winding paths of code, through forests of parentheses, and over mountains of syntax errors. They faced obstacles like the Wicked Witch of the Wrong Data Type and the Flying Monkeys of Misplaced Decimals. "Remember," Charlie said as they debugged yet another haunted function, "when we find the Schema Wizard, we must ask for client code that's as easy to use as a scarecrow's brain is to install—plug, play, and no hay required!"

What it does

The TigerBeetle Schema Wizard makes it easier for developers to model their business logic for TigerBeetle. Developers define a business logic schema in TOML, using a variety of provided ledger types. The Schema Wizard then generates high-level code that wraps the official TigerBeetle client libraries and provides easy-to-use functions for creating accounts and transfers.

By generating the client code from provided ledger types, we make it easier for developers to use TigerBeetle without thinking about questions like:

  • What ledger numbers should we use for each currency?
  • What's the difference between a ledger and a code?
  • Is a user's balance equal to the debits minus credits or vice versa?
  • How do we use linked transfers to enable cross-currency transfers across ledgers?

Challenges we ran into

The biggest one was actually wrapping my head around the double-entry bookkeeping model, which gave me more of an appreciation for what developers trying to use TigerBeetle will need to do. Aside from that, I ran into the following documentation and client library issues:

Oh, also, I didn't actually have enough time to start generating the client code from the schema 😋

Accomplishments that we're proud of

TigerBeetle's model seems -- and is -- very simple. However, figuring out how to correctly model your application's business logic using double-entry bookkeeping is quite tricky, unless you have prior experience with it. Something along the lines of this project would probably help developers get started with standard use cases much more quickly.

What's next for TigerBeetle Schema Wizard

  1. Actually generate the TypeScript client code from the schema
  2. Add more transfer types (including currency exchange)
  3. Add more ledger types
  4. Add support for other programming languages

Built With

Share this project:

Updates