Skip to content

Commit 1b08ced

Browse files
eisbawclaude
authored andcommitted
feat: implement web server mode
Add comprehensive web server functionality to Claudia, enabling Claude Code execution from mobile browsers while maintaining feature parity with the desktop Tauri app. Enable users to access Claude Code from mobile devices via web browser, addressing the limitation of desktop-only access. This allows for: - Mobile development workflows - Remote access to Claude Code functionality - Browser-based Claude execution without desktop app installation - Cross-platform compatibility - **Axum web server** with WebSocket support for real-time streaming - **Dual-mode event system** supporting both Tauri desktop and DOM web events - **Session management** with HashMap-based tracking of active WebSocket connections - **Process spawning** for actual Claude binary execution with stdout streaming - **REST API** mirroring all Tauri command functionality - `web_server.rs`: Main server w/ WebSocket handlers and REST endpoints - Real Claude binary execution with subprocess spawning - WebSocket message streaming for real-time output - Comprehensive session state management - CORS configuration for mobile browser access - `apiAdapter.ts`: Environment detection and unified API layer - `ClaudeCodeSession.tsx`: Enhanced with DOM event support for web mode - WebSocket client with automatic failover from Tauri to web mode - Event dispatching system compatible with existing UI components - **Build system**: `just web` command for integrated build and run - **Binary detection**: Bundled binary first, system PATH fallback - **Message protocol**: JSON-based WebSocket communication - **Event handling**: Session-scoped and generic event dispatching - **Error handling**: Comprehensive error propagation and UI feedback - ✅ Basic WebSocket streaming and session management - ✅ REST API endpoints for all core functionality - ✅ Event handling compatibility between Tauri and web modes - ✅ Error handling and WebSocket connection management - ✅ Process spawning and output streaming - ✅ Comprehensive debugging and tracing - Session-scoped event dispatching needs refinement for multi-user scenarios - Process cancellation requires additional implementation - stderr handling not yet fully implemented - Limited to single concurrent session per connection 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a05eb3c commit 1b08ced

19 files changed

Lines changed: 5567 additions & 894 deletions

bun.lockb

179 KB
Binary file not shown.

justfile

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Claudia - NixOS Build & Development Commands
2+
3+
# Show available commands
4+
default:
5+
@just --list
6+
7+
# Enter the Nix development environment
8+
shell:
9+
nix-shell
10+
11+
# Install frontend dependencies
12+
install:
13+
npm install
14+
15+
# Build the React frontend
16+
build-frontend:
17+
npm run build
18+
19+
# Build the Tauri backend (debug)
20+
build-backend:
21+
cd src-tauri && cargo build
22+
23+
# Build the Tauri backend (release)
24+
build-backend-release:
25+
cd src-tauri && cargo build --release
26+
27+
# Build everything (frontend + backend)
28+
build: install build-frontend build-backend
29+
30+
# Run the application in development mode
31+
run: build-frontend
32+
cd src-tauri && cargo run
33+
34+
# Run the application (release mode)
35+
run-release: build-frontend build-backend-release
36+
cd src-tauri && cargo run --release
37+
38+
# Clean all build artifacts
39+
clean:
40+
rm -rf node_modules dist
41+
cd src-tauri && cargo clean
42+
43+
# Development server (requires frontend build first)
44+
dev: build-frontend
45+
cd src-tauri && cargo run
46+
47+
# Run tests
48+
test:
49+
cd src-tauri && cargo test
50+
51+
# Format Rust code
52+
fmt:
53+
cd src-tauri && cargo fmt
54+
55+
# Check Rust code
56+
check:
57+
cd src-tauri && cargo check
58+
59+
# Quick development cycle: build frontend and run
60+
quick: build-frontend
61+
cd src-tauri && cargo run
62+
63+
# Full rebuild from scratch
64+
rebuild: clean build run
65+
66+
# Run web server mode for phone access
67+
web: build-frontend
68+
cd src-tauri && cargo run --bin claudia-web
69+
70+
# Run web server on custom port
71+
web-port PORT: build-frontend
72+
cd src-tauri && cargo run --bin claudia-web -- --port {{PORT}}
73+
74+
# Get local IP for phone access
75+
ip:
76+
@echo "🌐 Your PC's IP addresses:"
77+
@ip route get 1.1.1.1 | grep -oP 'src \K\S+' || echo "Could not detect IP"
78+
@echo ""
79+
@echo "📱 Use this IP on your phone: http://YOUR_IP:8080"
80+
81+
# Show build information
82+
info:
83+
@echo "🚀 Claudia - Claude Code GUI Application"
84+
@echo "Built for NixOS without Docker"
85+
@echo ""
86+
@echo "📦 Frontend: React + TypeScript + Vite"
87+
@echo "🦀 Backend: Rust + Tauri"
88+
@echo "🏗️ Build System: Nix + Just"
89+
@echo ""
90+
@echo "💡 Common commands:"
91+
@echo " just run - Build and run (desktop)"
92+
@echo " just web - Run web server for phone access"
93+
@echo " just quick - Quick build and run"
94+
@echo " just rebuild - Full clean rebuild"
95+
@echo " just shell - Enter Nix environment"
96+
@echo " just ip - Show IP for phone access"

0 commit comments

Comments
 (0)