--- title: 'Code Server' navigation: icon: i-ph:code-duotone description: 'Run VS Code in the browser as a devframe panel: detect a local editor, launch on demand, embed in an auto-authenticated iframe.' --- Run VS Code in the browser as a devframe panel: detect a local editor, launch on demand, embed in an auto-authenticated iframe. Package: `@devframes/plugin-code-server` · framework: **Vue** ![Code Server](/screenshots/plugin-code-server-1.png) _Launcher before start_ ![Code Server](/screenshots/plugin-code-server-2.png) _The embedded editor in the browser_ ## What it does - **Detection**: probes with `--version`; if absent, shows install info. - **Launch**: a managed child process on a free port, readiness-probed. - **Auto-auth**: fresh auth per launch; the editor opens signed in. ## Backends `mode: 'local'` (default) auto-detects `code-server`, else `code serve-web`. | `backend` | Binary | Auth handoff | |-----------|--------|--------------| | `'code-server'` | [`code-server`](https://github.com/coder/code-server) | password + session cookie | | `'ms-code-serve-web'` | [`code serve-web`](https://code.visualstudio.com/docs/remote/vscode-server) | connection token (`?tkn=`) | ## Tunnel mode `mode: 'tunnel'` runs `code tunnel` and embeds `vscode.dev`; first launch prompts a device login (`code` CLI). ## Standalone ```sh pnpx @devframes/plugin-code-server ``` ## Mount into a Vite host ```ts // vite.config.ts import { codeServerVite } from '@devframes/plugin-code-server/vite' import { defineConfig } from 'vite' export default defineConfig({ plugins: [ codeServerVite(), ], }) ``` ## Programmatic ```ts import { createCodeServerDevframe } from '@devframes/plugin-code-server' export default createCodeServerDevframe({ // backend: 'code-server', // default: auto-detect // mode: 'local', // 'local' | 'tunnel' // serverPort: 8080, // default: free port near 8080 // startOnBoot: true, // launch during setup // reuseExistingServer: true, // adopt a server on the port // tunnel: { name: 'my-box' }, }) ``` ## RPC Namespaced `devframes:plugin:code-server:*`: | Function | Type | Purpose | |----------|------|---------| | `detect` | `query` | Re-probe; returns installed/version/bin/backend/mode. | | `status` | `query` | Current status; connect descriptor if running. | | `start` | `action` | Launch and await readiness. | | `stop` | `action` | Stop the process. | Status (minus connect descriptor) mirrors into `…:state`. ## Source [`plugins/code-server`](https://github.com/devframes/devframe/tree/main/plugins/code-server)