claude-code-web
CLAUDE.md44 starsChanged 7 months agoMITView on GitHub
A monorepo that wraps the @anthropic-ai/claude-agent-sdk as a REST/SSE HTTP service (packages/server) with a React web UI (packages/web). The server exposes Claude Code as an HTTP API; the built frontend is embedded into the server's public/ directory for serving. Prerequisite: Claude Code CLI must be installed and logged in (claude command available). Fastify HTTP server with these layers: Data storage: Uses Claude CLI's native ~/.claude/projects/<dirName>/ directory. Project IDs are derived from the filesystem path (slashes → dashes). No separate database.
The file
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
A monorepo that wraps the @anthropic-ai/claude-agent-sdk as a REST/SSE HTTP service (packages/server) with a React web UI (packages/web). The server exposes Claude Code as an HTTP API; the built frontend is embedded into the server's public/ directory for serving.
Prerequisite: Claude Code CLI must be installed and logged in (claude command available).
Commands
Root (monorepo)
pnpm dev # Run both server and web in parallel (watch mode)
pnpm dev:server # Server only (tsx watch)
pnpm dev:web # Web only (vite --host)
pnpm build # Build both packages, then copy web/dist → server/public
pnpm start # Run the built serverpackages/server
pnpm --filter @claude-web/server dev # tsx watch src/cli.ts start
pnpm --filter @claude-web/server build # tsup
pnpm --filter @claude-web/server typecheck # tsc --noEmitpackages/web
pnpm --filter @claude-web/ui dev # vite --host (default port 5173)
pnpm --filter @claude-web/ui build # tsc -b && vite buildRelease
pnpm release:server # bump patch, build, npm publish @claude-web/server
pnpm release:ui # bump patch, build, npm publish @claude-web/uiArchitecture
packages/server
Fastify HTTP server with these layers:
src/cli.ts— Commander CLI (claude-web start / link / unlink)src/server.ts— Fastify setup: CORS, WebSocket, static files, Swagger, route registrationsrc/agent.ts— Core logic. Wraps@anthropic-ai/claude-agent-sdk'squery()in two modes:runAgent()— blocking, waits for completionrunAgentStream()— SSE streaming, emitspart/done/error/ask_userevents
src/store.ts— In-memory runtime session map +~/.claude/projectspath helpers. Sessions persist via Claude CLI's native JSONL format; runtime state (status, abort controller) lives in memory only.src/routes/— Three route files:project.ts— list, link, unlink projects; file tree; file readsession.ts— create/delete sessions, message history, send message (blocking or SSE)terminal.ts— WebSocket PTY vianode-pty
Data storage: Uses Claude CLI's native ~/.claude/projects/<dirName>/ directory. Project IDs are derived from the filesystem path (slashes → dashes). No separate database.
Session flow: A new session has sessionId: null until the SDK's first system message provides a real UUID via assignSessionId(). The resume option is passed on subsequent queries to continue the same conversation.
Tool permissions: bypassPermissions: true by default. AskUserQuestion tool is intercepted — in stream mode it emits an ask_user SSE event and waits for the client to POST a decision back.
packages/web
React 19 + Vite SPA with Ant Design, routing via react-router-dom v7.
src/http/index.ts— All API calls to the server. SSE handled withEventSource-style fetch +ReadableStream.src/pages/HomePage/— Lists linked projectssrc/pages/ProjectPage/— Three-panel layout: file tree (left), chat (center), file viewer / terminal (right)src/components/ChatPanel/— SSE message rendering; handlespart,done,ask_userevents; tool call/result displaysrc/components/ChatInput/—react-mentionsfor@fileand/commandcompletions, paste-to-image supportsrc/components/Terminal/— xterm.js terminal connected to the WebSocket PTYsrc/components/FileViewer/— shiki syntax-highlighted file viewer
In development (pnpm dev:web), Vite proxies /api to http://localhost:8003. In production, the built files are served directly by the Fastify static plugin.
Key env vars (server)
| Variable | Default | Effect |
LOG_LEVEL | debug | trace/debug/info/warn/error |
NODE_ENV | — | production → JSON log format (pino) |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

