Typescript
You can check out this repo: https://github.com/BoundaryML/baml-examples/tree/main/nextjs-starter
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
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.
You can modify your package.json
so you have a helper prefix in front of your build command.
package.json
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.