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.
Last Updated: October 28, 2025
OC Web - The web interface for OpenCode.
OC 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 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.
Platform Notes:
- On Windows, opencode-web uses your locally installed
opencodeCLI from PATH.⚠️ bunxlimitation: Cannot auto-launch the bundled server due to Bun's/bin/shissue. Use--external-serveror install locally. See details- ✅ Local install: Works perfectly with automatic server launch
- On macOS/Linux, opencode-web uses the bundled OpenCode SDK server (no additional installation required).
⚠️ 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-serverorOPENCODE_SERVER_URL).-p, --port <number>– port for the web UI (default: 3000).-H, --host <hostname>– interface to bind the web UI server to (default: localhost). Use0.0.0.0for LAN access.-h, --help– show the built-in usage help.
OpenCode Web uses three canonical environment variables for configuration:
| Variable | Description | Default |
|---|---|---|
OPENCODE_SERVER_URL |
Full URL to the OpenCode server (scheme + host + port) | http://localhost:4096 |
OPENCODE_WEB_HOST |
Interface to bind the web server to | localhost |
OPENCODE_WEB_PORT |
Port for the web UI server | 3000 |
Configuration precedence (highest to lowest):
- CLI flags (
--port,--host,--external-server) - Canonical environment variables (
OPENCODE_*) - Legacy environment variables (deprecated, see Migration section)
- Default values
Legacy variables (deprecated, maintained for backward compatibility):
PORT→ useOPENCODE_WEB_PORTHOST→ useOPENCODE_WEB_HOSTVITE_OPENCODE_SERVER_URL→ useOPENCODE_SERVER_URLOPENCODE_SERVER_PORT→ configure viaOPENCODE_SERVER_URLOPENCODE_SERVER_HOSTNAME→ configure viaOPENCODE_SERVER_URL
Additional optional variables:
OPENCODE_WEB_DISABLE_BUNDLED_SERVER: Set to1,true,yes, oronto skip launching the bundled serverVITE_BASE_PATH: Base path for reverse proxy deploymentsVITE_PWA_ASSETS_URL: URL prefix for PWA assets when using a CDNVITE_ALLOWED_HOSTS: Comma-separated list of allowed hostnames for the dev serverOPENCODE_WEB_CSS_TRANSFORMER: Choose betweenpostcss(default) orlightningcss
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: OPENCODE_SERVER_URL=http://10.0.0.200:4096 OPENCODE_WEB_PORT=8080 bun run dev
- Runs opencode-web in development mode on port 8080, 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 configuration using the canonical environment variables. For local development, setOPENCODE_SERVER_URLin.env.localor use the--external-serverCLI flag:Or run: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 OPENCODE_WEB_PORT, OPENCODE_WEB_HOST, OPENCODE_SERVER_URL, or NODE_ENV to customize runtime behavior. Configuration is resolved at runtime using the precedence order described in the Environment Variables section.
If you encounter Cannot find module errors when building on Windows (e.g., @rollup/rollup-win32-x64-msvc or @tailwindcss/oxide-win32-x64-msvc):
-
Clear node_modules and reinstall:
rm -rf node_modules bun install
These errors occur when lockfiles created on Linux/macOS omit Windows-specific platform binaries. The project now explicitly includes Windows binaries in
optionalDependenciesto prevent this issue (npm/cli#4828). -
If the error persists after reinstalling, ensure you're using the latest version of the repository with updated lockfiles that include:
@rollup/rollup-win32-x64-msvc(64-bit Intel/AMD)@rollup/rollup-win32-arm64-msvc(64-bit ARM, e.g., Surface devices)@tailwindcss/oxide-win32-x64-msvc(64-bit Intel/AMD)@tailwindcss/oxide-win32-arm64-msvc(64-bit ARM, e.g., Surface devices)
⚠️ Important:bunx opencode-webon Windows cannot automatically launch the bundled OpenCode Server due to a Bun runtime limitation with/bin/shremapping. You must either use an external server or install locally.
When running bunx opencode-web@latest on Windows, the bundled OpenCode Server fails to start with:
error: interpreter executable "/bin/sh" not found in %PATH%
[ERROR] Failed to start OpenCode Server.
This happens because:
bunxcreates temporary installations that don't properly install the Windows OpenCode binary- Bun's current Windows implementation cannot find
/bin/shwhen spawning the bundled server process - The bundled server requires the
opencodeCLI, which fails under these conditions
Option 1: Use an External OpenCode Server (Easiest for bunx)
First, start an OpenCode server separately:
# Install OpenCode CLI globally if you haven't already
# Download from: https://github.com/opencode-ai/opencode
# Start the server
opencode serve --hostname=127.0.0.1 --port=4096Then run opencode-web pointing to it:
bunx opencode-web@latest --external-server http://127.0.0.1:4096Option 2: Install Locally (Recommended for regular use)
Install the package locally so Windows binaries are properly resolved:
# Create a directory and install
mkdir my-opencode-web
cd my-opencode-web
bun install opencode-web
# IMPORTANT: Run the binary directly on Windows
bun run packages/opencode-web/bin/opencode-web.jsOr install globally:
bun add -g opencode-web
# Then run the binary directly
opencode-webbun run packages/opencode-web/bin/opencode-web.js) rather than using the npm script (bun run opencode-web). The npm script may still encounter the same /bin/sh limitation. Running the binary directly ensures proper Windows binary resolution.
Option 3: Build from Source (For contributors or advanced users)
git clone https://github.com/sst/opencode-web
cd opencode-web
bun install
bun run build
bun run packages/opencode-web/bin/opencode-web.jsThis limitation only affects Windows users running via bunx:
- ✅ macOS/Linux + bunx: Works perfectly (uses bundled SDK)
- ✅ Windows + local install: Works perfectly (proper binary resolution)
⚠️ Windows + bunx: Requires--external-serverflag
The CLI detects bunx on Windows and exits early with actionable guidance. If you see the error, it means:
- You're on Windows
- Running from a
bunxtemporary directory - No
--external-serverflag was provided
For more information about this Bun limitation, see:
- Bun issue tracking: oven-sh/bun#issues (to be filed - search for "/bin/sh Windows")
- OpenCode upstream: sst/opencode#issues (to be filed - search for "Windows bunx")
- OpenCode Server: https://github.com/sst/opencode
If you encounter errors even with --external-server:
-
Verify the server is running:
# Test the server URL curl http://127.0.0.1:4096/health
-
Check firewall settings: Ensure localhost connections are allowed
-
Try a different port: If 4096 is in use, start the server on another port:
opencode serve --hostname=127.0.0.1 --port=4097 bunx opencode-web@latest --external-server http://127.0.0.1:4097
-
Use host IP instead of localhost: Sometimes
127.0.0.1works better thanlocalhoston Windows
If you're upgrading from an earlier version, OpenCode Web has simplified configuration to three canonical environment variables. Legacy variables are still supported but deprecated.
| Old Variable | New Variable | Notes |
|---|---|---|
PORT |
OPENCODE_WEB_PORT |
Same meaning, new name |
HOST |
OPENCODE_WEB_HOST |
Same meaning, new name |
VITE_OPENCODE_SERVER_URL |
OPENCODE_SERVER_URL |
Same meaning, shorter name |
OPENCODE_SERVER_PORT |
OPENCODE_SERVER_URL |
Now specify full URL (e.g., http://localhost:4096) |
OPENCODE_SERVER_HOSTNAME |
OPENCODE_SERVER_URL |
Now specify full URL (e.g., http://localhost:4096) |
Before:
PORT=3000
HOST=0.0.0.0
VITE_OPENCODE_SERVER_URL=http://10.0.0.5:5000After:
OPENCODE_WEB_PORT=3000
OPENCODE_WEB_HOST=0.0.0.0
OPENCODE_SERVER_URL=http://10.0.0.5:5000Before (bundled server config):
OPENCODE_SERVER_PORT=5002
OPENCODE_SERVER_HOSTNAME=192.168.1.100After:
OPENCODE_SERVER_URL=http://192.168.1.100:5002When using legacy variables in development mode, you'll see warnings like:
[deprecate] PORT is deprecated, prefer OPENCODE_WEB_PORT
These warnings do not appear in production. Update your configuration at your convenience—legacy variables will continue to work during the transition period.
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.
The build system supports different release channels that automatically select the appropriate OpenCode SDK version:
- Production builds (
OPENCODE_CHANNEL=latest): Uses stable SDK from npm (^0.15.14) - Dev/Preview builds (
OPENCODE_CHANNEL=devorpreview): Uses latest dev branch from GitHub for unreleased features
# Build with stable SDK (production)
OPENCODE_CHANNEL=latest bun run build:npm
# Build with dev SDK (includes unreleased MCP features)
OPENCODE_CHANNEL=dev bun run build:npmThe SDK version is automatically set during the build process in script/build-npm.ts.
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.