Using @daml/ledger TypeScript library for backend code

Is using the TypeScript library @daml/ledger supported for use in non-UI applications (e.g. a Node JS backend)? I believe it is technically possible, but the docs seem to be mostly focused on using it for front-end development. Just want to make sure that using it in a Node JS backend is a supported use case and won’t be broken by any future changes.

1 Like

Hi @huw,

I’m not part of the team responsible for those bindings at this time, but I was involved in their creation a few years ago. I can’t speak in any official capacity with respect to support, but here’s what I can tell you.

The TypeScript bindings as they exist today have been built the way they are (in three separate packages) specifically to enable multiple use-cases. The @daml/ledger library is deliberately devoid of any UI concern in the hopes that it can be used in “headless” (i.e. mostly node.js) contexts; this is the main reason why it was made a separate library rather than just a part of @daml/react. (Also, to a lesser extent, to enable usage with other UI frameworks, but that wasn’t as much of a concern back then.) It was also partly meant as a replacement for the preexisting (and now deprecated) node.js bindings.

That said, as far as I remember it was still built with the @daml/react library as its main driving use-case/“client”, so it hasn’t been tested much in a node.js context. There may be missing features to fully support that use-case.

I’m also not aware of any plan to make significant changes to the @daml/ledger library, though I can’t be positive this means there are none.

1 Like

Thanks @Gary_Verhaegen . That’s what I thought but it’s good to have confirmation.