minhvo.vercel.app
Tue Mar 03 2026

Git Account Switcher
Electrobun
Bun
TypeScript
React
TailwindCSS
macOS
Keychain
Menu Bar
Developer Tools
Native macOS menu bar app for atomic, transactional GitHub account switching — Keychain, git config, and gh CLI in one click.
Overview
A native macOS desktop app to switch between multiple GitHub accounts with a single click. It updates the macOS Keychain credentials, the global git config (user.name / user.email), and the GitHub CLI session — all in a single transaction with rollback on failure.
I shipped this twice: once with Electrobun + Bun + native macOS WebView for the smaller binary, and a parallel native version in Swift + SwiftUI (GitAccountSwitcher) to compare first-paint, memory, and DX.
Features
- Instant Account Switching with atomic, transactional updates
- Keychain Integration via
git credential-osxkeychain - Git Config Management of
~/.gitconfig - GitHub CLI Support through
gh auth switch - System Tray menu for switching without opening the main window
- Credential Discovery auto-detects existing GitHub credentials from Keychain on first launch
- Encrypted Storage — account data stored in AES-256-GCM JSON files
- Rollback on Failure — any failed step rolls back to the previous state
- Launch at Login via a LaunchAgent plist
- Glass-effect UI with spring-physics animations
Technical Stack
| Layer | Technology |
|---|---|
| Framework | Electrobun v1 |
| Runtime | Bun |
| Frontend | React 18 + Tailwind CSS 3 + Vite |
| Animations | Framer Motion (spring physics) |
| Language | TypeScript |
| Storage | Encrypted JSON (AES-256-GCM) |
| IPC | Electrobun typed RPC |
Implementation Highlights
- Transactional switch: every switch composes Keychain writes + git config writes +
gh auth switchinto a single unit; any failure unwinds all prior writes - Typed RPC between the Bun main process and the WebView, modeled after Electron's IPC but enforced through a shared
rpc-types.tsschema - Native WebView via Electrobun yielded an installer ~10× smaller than equivalent Electron builds, at the cost of a longer cold-start vs the Swift variant
- Side-by-side comparison with the SwiftUI build informed the tradeoff write-up: SwiftUI wins on first-paint and idle memory; Electrobun wins on cross-platform reuse
Role & Responsibilities
- Architected the transactional credential update with rollback semantics
- Wrote the Bun-side services (Keychain, git config,
ghdetection, notifications, LaunchAgent) - Built the React UI, welcome wizard, and CLI setup wizard
- Shipped the parallel SwiftUI implementation for benchmarking