VibeTree is a multi-platform application that enables parallel development with AI assistance across multiple git worktrees. The architecture follows a monorepo structure with clear separation between applications and shared packages.
vibetree/
├── apps/ # Applications
│ ├── desktop/ # Electron desktop app
│ ├── server/ # Backend service for web/mobile
│ └── web/ # Progressive Web App
│
├── packages/ # Shared libraries
│ ├── core/ # Business logic and types
│ └── ui/ # Shared UI components
│
├── pnpm-workspace.yaml # Workspace configuration
├── turbo.json # Build orchestration
└── package.json # Root package scripts
Purpose: Shared business logic, types, and utilities
Key Exports:
- Types:
Worktree,GitStatus,ShellSession, etc. - Adapters:
CommunicationAdapterinterface for platform abstraction - Utilities: Git parsing functions (
parseWorktrees,parseGitStatus)
Purpose: Shared React components for consistent UI across platforms
Key Components:
Terminal: Cross-platform terminal component using xterm.js- Future:
WorktreeList,GitDiffViewer, common UI elements
Platform: Electron Communication: IPC (Inter-Process Communication) Features:
- Native terminal via node-pty
- Direct file system access
- IDE integration (VS Code, Cursor)
- Native git operations
Platform: Node.js Communication: WebSocket + REST API Features:
- Terminal session management
- Git operations API
- QR code authentication
- JWT-based sessions
- Device pairing
Platform: Browser (PWA) Communication: WebSocket Features:
- Mobile-responsive design
- Touch-optimized terminal
- Progressive Web App capabilities
- QR code scanning for pairing
All applications use the same CommunicationAdapter interface, enabling code reuse:
interface CommunicationAdapter {
// Terminal operations
startShell(worktreePath: string): Promise<ShellStartResult>
writeToShell(processId: string, data: string): Promise<void>
// Git operations
listWorktrees(projectPath: string): Promise<Worktree[]>
addWorktree(projectPath: string, branch: string): Promise<void>
// System operations
selectDirectory(): Promise<string>
getTheme(): Promise<'light' | 'dark'>
}Desktop (Electron):
UI → IPCAdapter → IPC → Main Process → Native APIs
Web/Mobile:
UI → WebSocketAdapter → WebSocket → Server → Native APIs
- Reasoning: Code sharing, unified versioning, easier refactoring
- Tool: pnpm workspaces + Turborepo for efficient builds
- Reasoning: Platform abstraction without code duplication
- Benefit: Same components work on desktop and web
- Reasoning: Consistent user experience across platforms
- Implementation: React components in @vibetree/ui package
- Reasoning: Parsing logic is platform-independent
- Benefit: Server and desktop use same git utilities
- Desktop app generates QR code with temporary token (5 min expiry)
- Mobile device scans and sends device info
- Server validates token and issues JWT (7 day expiry)
- All subsequent requests use JWT authentication
- Local network only by default
- HTTPS/WSS recommended for production
- Device fingerprinting for session management
- Automatic session cleanup for inactive connections
# Install dependencies
pnpm install
# Development
pnpm dev # All services
pnpm dev:desktop # Desktop only
pnpm dev:server # Server only
pnpm dev:web # Web only
# Building
pnpm build # All packages
pnpm package:desktop # Package desktop app
# Type checking
pnpm typecheck- Shared Logic: Add to
packages/core - UI Components: Add to
packages/ui - Platform-Specific: Add to respective app in
apps/
- Build core packages first:
pnpm build --filter @vibetree/core - Test in target application:
pnpm dev:desktop - Verify cross-platform compatibility
- React Native mobile app (
apps/mobile) - Shared UI component library expansion
- WebRTC for P2P connections
- Cloud sync capabilities
- Collaborative features (shared sessions)
- Plugin system for extensibility
- Self-hosted server option
- End-to-end encryption for remote access
- Virtual scrolling for large outputs
- Serialization for session persistence
- Efficient diff algorithms for git operations
- Turborepo caching for unchanged packages
- Tree shaking for smaller bundles
- Code splitting in web application
- WebSocket connection pooling
- Message batching for bulk operations
- Automatic reconnection with exponential backoff
- Electron Builder for cross-platform packages
- Auto-updater for seamless updates
- Code signing for trusted distribution
- Docker containerization
- Environment-based configuration
- Health check endpoints
- Graceful shutdown handling
- Static hosting (Vercel, Netlify, etc.)
- PWA manifest for installability
- Service worker for offline capability
- CDN for global distribution