Development Guide
Setup
Prerequisites
- macOS 14.0+
- Xcode 16.0+
- Node.js 22.12+
- Bun 1.0+
Clone & Build
Project Structure
Code Patterns
Swift (macOS/iOS)
Observable PatternTypeScript (Web)
Service ClassesDevelopment Workflow
Hot Reload Setup
Web DevelopmentTesting
Unit TestsDebugging
View LogsCommon Tasks
Add New API Endpoint
- Define in
web/src/server/routes/api.ts - Add types in
web/src/shared/types.ts - Update client in
web/src/client/services/api.ts - Add tests in
web/tests/api.test.ts
Add New Menu Item
- Update
mac/VibeTunnel/Presentation/MenuBarView.swift - Add action in
mac/VibeTunnel/Core/Actions/ - Update settings if needed
Modify Terminal Protocol
- Update framing/types in
web/src/shared/ws-v3.ts - Update server routing in
web/src/server/services/ws-v3-hub.ts - Update clients:
- Web:
web/src/client/services/terminal-socket-client.ts - iOS:
ios/VibeTunnel/Services/BufferWebSocketClient.swift
- Web:
- Add/adjust tests:
web/src/test/e2e/websocket-v3.e2e.test.ts
Build System
macOS Build
Web Build
Release Build
Code Quality
Linting
Formatting
Performance
Profiling
Optimization Tips
- Use binary protocol for terminal data
- Batch WebSocket messages (16ms intervals)
- Lazy load terminal sessions
- Cache static assets with service worker
Troubleshooting
| Issue | Solution |
|---|---|
| Port in use | lsof -i :4020 then kill process |
| Build fails | Clean: rm -rf node_modules dist |
| Tests fail | Check Node/Bun version |
| Hot reload broken | Restart dev server |
Contributing
- Fork repository
- Create feature branch
- Follow code style
- Add tests
- Update documentation
- Submit PR