Ultimate Guide to Optimizing Development Workflow with Bun, Biome, TurboRepo, Husky, PM2, and GitHub Actions
Optimizing your development workflow is essential for speed, efficiency, and automation. This guide covers Bun, Biome, TurboRepo, Husky, PM2, and GitHub Actions, helping you:
- Speed up dependency management with Bun
- Optimize linting and formatting with Biome
- Improve monorepo performance with TurboRepo
- Automate Git hooks using Husky
- Optimize production processes using PM2 with Bun
- Enhance CI/CD performance using GitHub Actions
1. Using Bun for Faster Dependency Management
Bun is a modern alternative to Node.js that provides a fast runtime, package manager, and test runner.
1.1 Install Bun
curl -fsSL https://bun.sh/install | bash
or using Homebrew (Mac):
brew install oven-sh/bun/bun
1.2 Set Bun as Default Package Manager
Modify package.json:
{
"packageManager": "bun@latest"
}
1.3 Install Dependencies with Bun
bun install
- 10x faster than npm and yarn
- Uses
bun.lockbfor deterministic installs
2. Using Biome for Fast Linting and Formatting
Biome is an all-in-one tool that replaces ESLint & Prettier.
2.1 Install Biome
bun add -D @biomejs/biome
2.2 Lint and Format Code
biome check .
biome format . --write
2.3 Ignore Folders in Biome
Create a .biomeignore file:
node_modules
dist
coverage
3. Using TurboRepo to Optimize Monorepos
TurboRepo speeds up monorepos using caching and parallel execution.
3.1 Install TurboRepo
bun add -D turbo
3.2 Configure turbo.json to Use Bun
{
"$schema": "https://turbo.build/schema.json",
"packageManager": "bun",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
}
}
}
3.3 Run Turbo Commands with Bun
Modify package.json:
{
"scripts": {
"build": "bun run turbo run build"
}
}
Run with:
bun run build
4. Automate Git Hooks Using Husky
Instead of manually setting up Git hooks, Husky automates them.
4.1 Install Husky
bun add -D husky
bunx husky-init && bun install
4.2 Add Git Hooks
Pre-commit: Format and Lint Code
npx husky add .husky/pre-commit "bun biome format . --write && bun biome check ."
Commit Message: Enforce Conventional Commits
npx husky add .husky/commit-msg "bun run commitlint --edit $1"
5. Optimizing Production with PM2 and Bun
PM2 is a process manager for Node.js and Bun apps.
5.1 Install PM2
bun add -g pm2
5.2 Start an App with PM2 Using Bun
pm2 start "bun run start" --name my-app
5.3 Auto-Restart on Failure
pm2 start "bun run start" --name my-app --watch
5.4 Save and Auto-Start PM2 on System Boot
pm2 save
pm2 startup
6. GitHub Actions: Automating CI/CD with Caching
6.1 Configure GitHub Actions (ci.yml)
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Cache Bun Dependencies
uses: actions/cache@v3
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Run Build
run: bun run build
- Caches dependencies for faster builds
- Ensures clean and reproducible installs
7. Full Optimization Workflow Summary
| Optimization | Tool Used | Benefit |
|---|---|---|
| Fast Dependency Management | Bun | 10x faster installs, runtime speedup |
| Linting & Formatting | Biome | Replaces ESLint & Prettier, faster performance |
| Monorepo Optimization | TurboRepo | Caching, parallel execution |
| Git Hooks Automation | Husky | Enforces pre-commit rules and commit conventions |
| Process Management | PM2 | Ensures Bun applications restart on failure |
| CI/CD Automation | GitHub Actions | Cached dependencies, automated builds |
8. Next Steps
- Migrate your projects to Bun, Biome, TurboRepo, and PM2
- Set up Husky for pre-commit checks
- Optimize CI/CD with GitHub Actions
By implementing this fully optimized workflow, you’ll have:
- Blazing-fast builds
- Automated code quality enforcement
- Optimized monorepos and caching
- Seamless CI/CD with minimal downtime
Your development process will be leaner, faster, and more efficient than ever! 🚀