Step 2 of 29
Install Bun, pick an editor, run your first program
ติดตั้ง Bun และรันโปรแกรมแรก — ใช้เป็น runtime และ package manager ทั้งสองฝั่ง
Install Bun, pick an editor, run your first program.
macOS / Linux:
curl -fsSL https://bun.sh/install | bash
Windows:
powershell -c "irm bun.sh/install.ps1 | iex"
Verify:
bun --version
Use VS Code. Install the TypeScript extension (built-in) and the Bun extension for intellisense.
Other options: WebStorm, Zed, Neovim. All work. VS Code has the best TypeScript support.
Create a file called index.ts:
console.log("Hello from Bun!")
Run it:
bun run index.ts
Output: Hello from Bun!
No build step. No package.json. No config. Write TypeScript, run it.
For a real project, initialize properly:
mkdir my-app && cd my-app
bun init
This creates a package.json and tsconfig.json. The package.json tracks dependencies. The tsconfig.json configures TypeScript.
bun add elysia
Bun installs packages into node_modules and updates package.json. Faster than npm, yarn, or pnpm.
In package.json:
{
"scripts": {
"dev": "bun run --watch index.ts"
}
}
bun run dev
The --watch flag restarts the process when files change. No manual restart needed.
That is the entire setup. No webpack, no babel, no compile step. Bun handles it all.