Typescript
To set up BAML with Typescript do the following:
Install BAML VSCode/Cursor Extension
https://marketplace.visualstudio.com/items?itemName=boundary.baml-extension
- syntax highlighting
- testing playground
- prompt previews
Add BAML to your existing project
This will give you some starter BAML code in a baml_src
directory.
npm
pnpm
yarn
bun
deno
Generate the baml_client
typescript package from .baml
files
One of the files in your baml_src
directory will have a generator block. This tells BAML how to generate the baml_client
directory, which will have auto-generated typescript code to call your BAML functions.
npm
pnpm
yarn
bun
deno
If you need baml_client to be ‘ESM’ compatible, you can add the following generator
configuration to your .baml
file:
You can modify your package.json
so you have a helper prefix in front of your build command.
See What is baml_src to learn more about how this works.

If you set up the VSCode extension, it will automatically run baml-cli generate
on saving a BAML file.