Note: This is an independent, community-maintained project created by fans of OpenCode. We are not affiliated with SST Corp. or the official OpenCode project. For the official OpenCode CLI, visit opencode.ai.
The web interface for OpenCode.
OpenCode Web is a web-based interface for the OpenCode Server API, providing a browser-based way to interact with OpenCode sessions. Built on TanStack Start, React, and Bun, it offers a complete web experience for managing and monitoring OpenCode workflows.# Latest stable release
bunx opencode-web@latest
# Dev release (bleeding edge)
bunx opencode-web@dev# Using Bun
bun add -g opencode-web
opencode-web
# Using npm
npm install -g opencode-web
opencode-web
# Using yarn
yarn global add opencode-web
opencode-webcurl -sSL https://raw.githubusercontent.com/kcrommett/opencode-web/main/install.sh | bashOnce started, open http://localhost:3000 in your browser. The CLI launches a local OpenCode Server through the OpenCode SDK by default and wires its URL into the web client automatically. Use the command-line flags to connect to an existing server or adjust the listening host/port without touching environment variables.
⚠️ Security Warning: This application runs without authentication by default. Do not expose it directly to the internet without proper security measures. For secure remote access, consider using Cloudflare Access with Cloudflare Tunnel to add authentication and protect your instance.
--external-server <url>– connect to an existing OpenCode Server and skip the bundled instance.--no-bundled-server– skip launching the bundled server (requires--external-serverorVITE_OPENCODE_SERVER_URL).-p, --port <number>– port for the web UI (default: 3000).-H, --host <hostname>– interface to bind the web UI server to (default: 127.0.0.1). Use0.0.0.0for LAN access.-h, --help– show the built-in usage help.
The OpenCode Server URL is resolved in the following precedence order:
OPENCODE_SERVER_URL(CLI flag or environment variable)VITE_OPENCODE_SERVER_URL(build-time environment variable)- SSR runtime
globalThis.__OPENCODE_SERVER_URL__ - Default:
http://localhost:4096
PORT: Web server port (default: 3000)HOST: Web server host/interface (default: 127.0.0.1)VITE_OPENCODE_SERVER_URL: Use an existing OpenCode Server instead of the bundled oneOPENCODE_SERVER_URL: Override the OpenCode Server URL at runtimeOPENCODE_WEB_DISABLE_BUNDLED_SERVER: Set to1,true,yes, oronto skip launching the bundled serverOPENCODE_SERVER_PORT: Port for the bundled OpenCode Server (default: 4096)OPENCODE_SERVER_HOSTNAME: Hostname for the bundled OpenCode Server (default: 127.0.0.1)
Example: opencode-web --external-server http://10.0.0.200:4096 --host 0.0.0.0 -p 8080
- Runs opencode-web listening on all interfaces at port 8080, connecting to an existing OpenCode Server at
http://10.0.0.200:4096
Example: VITE_OPENCODE_SERVER_URL=http://10.0.0.200:4096 bun run dev
- Runs opencode-web in development mode, connecting to an existing OpenCode Server at
http://10.0.0.200:4096
- Access OpenCode sessions from any browser without additional software installation
- Real-time monitoring of active sessions with live updates
- Browser-native features like screenshots, downloads, and responsive design
- Ideal for demonstrations, training, and remote collaboration
Reconnect to an existing conversation with full command history, agent context, and pending tasks so you can pick up work between devices.
Follow model outputs, reasoning traces, and tool runs via Server-Sent Events so you always know what the agent is doing—even from your phone.
Switch between saved agent presets, route complex tasks to specialists, and keep context switching frictionless from the browser.
Quick access to different AI models with an intuitive picker interface
Browse project trees, view files, and download artifacts directly from the web interface. Syntax highlighting keeps context rich.
Quickly view images and animations in your browser, or download other binary files.
Toggle between opencode color palettes to match whatever theme you prefer.
Progressive Web App hooks keep the client a tap away with full-screen, app-like usage—ideal for tablets or a second monitor.
- TanStack Start + React Router power hybrid SSR/CSR routing with file-based conventions.
- Bun server (
server.ts) proxies event streams to the OpenCode backend and serves the compiled client. - Shared lib layer (
src/lib/) wraps the OpenCode HTTP API for seamless integration. - Composable UI primitives in
src/app/_components/ui/provide a consistent design system.
Important Note for Custom Deployments: Browser access to the OpenCode server must be mediated through the web app. The frontend cannot directly connect to the OpenCode API due to proxy requirements. All requests are routed through the web server's /api/* endpoints to ensure compatibility with external server configurations.
- Bun 1.3.x (toolchain pinned in
bunfig.toml) - Node.js 18+ for editor integrations and lint tooling
- OpenCode Server (the CLI bundles one automatically; pass
--external-serverto reuse an existing instance)
- Install dependencies
bun install
- Configure environment
The web app resolves the OpenCode Server URL using the precedence order described above. For local development, setVITE_OPENCODE_SERVER_URLin.env.localor use the--external-serverCLI flag:Or run:VITE_OPENCODE_SERVER_URL=http://localhost:4096
bun run dev --external-server http://localhost:4096 - Run the dev server
The app listens on http://localhost:3000. Replace
bun run dev
localhostwith a LAN IP to check in from another device on the same network.
- Build the client + SSR bundles
Compiled assets land in
bun run build
dist/client(static) anddist/server(SSR handler). - Serve the production bundle
The
bun run start
startscript executesserver.ts, which:- Loads the TanStack Start handler from
dist/server/server.js - Serves static assets from
dist/client - Proxies
/api/eventsto your OpenCode server for SSE streaming
- Loads the TanStack Start handler from
Set PORT, OPENCODE_SERVER_URL, VITE_OPENCODE_SERVER_URL, or NODE_ENV to customize runtime behavior. The server URL is resolved at runtime using the precedence order.
src/
├── app/ # TanStack Start routes & UI components
│ └── _components/ # Message renderers, UI primitives, dialogs, pickers
├── contexts/ # React contexts for session + theme state
├── hooks/ # Reusable hooks around OpenCode data flows
├── lib/ # HTTP client, command parser, theme helpers
├── router.tsx # Router configuration
server.ts # Bun production server wrapper
vite.config.ts # Vite + TanStack Start configuration
Key entry points include:
src/lib/opencode-server-fns.ts– server-side wrappers for the OpenCode HTTP APIsrc/app/_components/message/– renders reasoning, snapshots, tool output, and patchessrc/app/_components/ui/– button, dialog, picker, and form controls
bun run dev– launch the development server with hot reloadbun run build– produce production-ready client + SSR bundlesbun run start– serve the compiled build via the Bun runtimebun run lint– enforce shared ESLint rulesbun x tsc --noEmit– typecheck without generating artifactsbun run test– run Playwright smoke tests when present
- Silence logs in production by guarding with
if (process.env.NODE_ENV !== "production"). - Favor Bun utilities (e.g.,
Bun.file) in shared helpers when they simplify IO or streaming. - Keep server function schemas synced with the OpenCode SDK.
- Confirm UI changes in both desktop and mobile breakpoints.
This application is designed for local development and does not include built-in authentication. When exposing it outside your local network:
- Never expose directly to the internet without authentication
- Use a reverse proxy with authentication like Cloudflare Access
- Recommended setup: Cloudflare Tunnel + Cloudflare Access for secure, authenticated access
- Network isolation: Keep it within your firewall when possible
- Use VPN for remote access instead of direct exposure
Example Cloudflare Tunnel setup:
# Install cloudflared
brew install cloudflared # macOS
# Or download from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/
# Create a tunnel with Access protection
cloudflared tunnel --url http://localhost:3000When using reverse proxies like Cloudflare Access, Nginx, or Apache:
- CORS Headers: The server automatically adds CORS headers when accessed via reverse proxy
- Virtual Endpoints: Development endpoints (
@react-refresh,@vite-plugin-pwa/pwa-entry-point-loaded) return empty responses in production - PWA Assets: Use relative URLs by setting
VITE_PWA_ASSETS_URL=""when building - Base Path: Set
VITE_BASE_PATH="/your-path"if hosting under a subdirectory
Example production build for reverse proxy:
VITE_PWA_ASSETS_URL="" VITE_BASE_PATH="" bun run buildFollow the shared contributor handbook in AGENTS.md. Before opening a PR, run lint + typecheck, describe UI-visible changes, and flag any server-function updates.