This is a simple template for starting a Preact project bootstrapped with Bun, with TypeScript instead of the default JavaScript configuration.
It uses Bun's built-in dev server and bundler — no Vite, webpack, or extra build tooling. Bun serves index.html directly, transpiles TypeScript/JSX and bundles CSS and assets out of the box, with hot module reloading in development.
To create a TS Preact project with Bun:
bun create johanneslil/bun-preact-ts ./bun-preact-ts-appTo create a regular JS Preact project with bun:
bun create preact ./bun-preact-appInstall dependencies, then start the development server.
bun install
bun run devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying src/app.tsx. The page auto-updates as you edit the file (HMR).
bun run buildThe bundled, minified output is written to dist/.
bun run typecheckTo learn more about the tools used in this template, take a look at the following resources:
- Preact Documentation - learn about Preact's features.
- Learn Preact - an interactive Preact tutorial.
- Bun Documentation - the Bun runtime, bundler, and dev server.
- Bun HTML & fullstack dev server - how
index.htmlis served and bundled. - TypeScript Documentation - learn about TypeScript.
You can check out the Preact GitHub repository and the Bun GitHub repository - your feedback and contributions are welcome!