Opcode Web Server Design
Description
This document describes the implementation of Opcode's web server mode, which allows access to Claude Code from mobile devices and browsers while maintaining full functionality.
Installation
claude install-skill https://github.com/winfunc/opcode README
Opcode Web Server Design
This document describes the implementation of Opcode's web server mode, which allows access to Claude Code from mobile devices and browsers while maintaining full functionality.
Overview
The web server provides a REST API and WebSocket interface that mirrors the Tauri desktop app's functionality, enabling phone/browser access to Claude Code sessions.
Architecture
┌─────────────────┐ WebSocket ┌─────────────────┐ Process ┌─────────────────┐
│ Browser UI │ ←──────────────→ │ Rust Backend │ ────────────→ │ Claude Binary │
│ │ REST API │ (Axum Server) │ │ │
│ • React/TS │ ←──────────────→ │ │ │ • claude-code │
│ • WebSocket │ │ • Session Mgmt │ │ • Subprocess │
│ • DOM Events │ │ • Process Spawn │ │ • Stream Output │
└─────────────────┘ └─────────────────┘ └─────────────────┘
Key Components
1. Rust Web Server (`src-tauri/src/web_server.rs`)
**Main Functions:**
- undefined
**Key Features:**
- undefined
2. Frontend Event Handling (`src/components/ClaudeCodeSession.tsx`)
**Dual Mode Support:**
const listen = tauriListen || ((eventName: string, callback: (event: any) => void) => {
// Web mode: Use DOM events
const domEventHandler = (event: any) => {
callback({ payload: event.detail });
};
window.addEventListener(eventName, domEventHandler);
return Promise.resolve(() => window.removeEventListener(eventName, domEventHandler));
});
**Message Processing:**
- undefined
3. WebSocket Communication (`src/lib/apiAdapter.ts`)
**Request Format:**
{
"command_type": "execute|continue|resume",
"project_path": "/path/to/project",
"prompt": "user prompt",
"model": "sonnet|opus",
"session_id": "uuid-for-resume"
}
**Response Format:**
{
"type": "start|output|completion|error",
"content": "parsed Claude message",
"message": "status message",
"status": "success|error"
}
Message Flow
1. Prompt Submission
Browser → WebSocket Request → Rust Backend → Claude Process
2. Streaming Response
Claude Process → Ru
Related Agents
Html Css
| Web standards for semantic markup, maintainable styling, and accessibility. | - | [wshobson/agents](https://github.com/wshobson/agents) |
Design community ui-visual-validator
| You are an experienced UI visual validation expert specializing in comprehensive visual testing and... | sonnet | [wshobson/agents](https://github.com/wshobson/agents) |
Design community Refactor Clean
| You are a code refactoring expert specializing in clean code principles, SOLID design patterns, and... | - | [wshobson/agents](https://github.com/wshobson/agents) |
Design community team-composition-analysis
| Design optimal team structures, hiring plans, compensation strategies, and equity allocation for ear... | - | [wshobson/agents](https://github.com/wshobson/agents) |
Design community Auto Claude
by AndyMik90 - Autonomous multi-agent coding framework for Claude Code (Claude Agent SDK) that integrates the full SDLC - "plans, builds, and validates software for you". Features a slick...
Design community UI Designer (contains)
Design
Creates beautiful user interfaces with modern design principles
Design community 6 tools Related Skills
Algorithmic Art
Create generative art using p5.js with seeded randomness, flow fields, and particle systems
Brand Guidelines
Apply Anthropic's official brand colors and typography to artifacts
Canvas Design
Create beautiful visual art in PNG and PDF documents using design philosophy