How I initialize my Bun projects
Bun has a bun init command that helps you initialize a new project. However, afterwards I also do these:
Use
@tsconfig/buninstead of providedtsconfig.json. This provides a stricter TypeScript configuration and also reduces the need to maintain our own tsconfig file.bun add @tsconfig/bun --dev echo '{ "extends": "@tsconfig/bun/tsconfig.json" }' > tsconfig.jsonAlso install
@types/node. Without it, sometimes TypeScript would emit type errors, saying that “Buffer is not assignable to Uint8Array”.bun add @types/node --devPin the Bun version in mise-en-place config. This helps with reproducability when working with multiple projects and when deploying.
mise use bun@latestLater, the correct version of Bun will be installed when you run
mise install.