{"id":44927698,"url":"https://github.com/viagen-dev/viagen","last_synced_at":"2026-04-01T19:19:38.032Z","repository":{"id":338551499,"uuid":"1158262240","full_name":"viagen-dev/viagen","owner":"viagen-dev","description":"Vite dev server plugin that exposes endpoints for chatting with Claude Code SDK","archived":false,"fork":false,"pushed_at":"2026-03-20T04:10:28.000Z","size":1216,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-20T19:58:12.318Z","etag":null,"topics":["claude-code","github","vercel","vite"],"latest_commit_sha":null,"homepage":"https://viagen.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/viagen-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-15T03:55:25.000Z","updated_at":"2026-03-20T04:10:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/viagen-dev/viagen","commit_stats":null,"previous_names":["cif/viagen","viagen-dev/viagen"],"tags_count":45,"template":false,"template_full_name":null,"purl":"pkg:github/viagen-dev/viagen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viagen-dev%2Fviagen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viagen-dev%2Fviagen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viagen-dev%2Fviagen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viagen-dev%2Fviagen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/viagen-dev","download_url":"https://codeload.github.com/viagen-dev/viagen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viagen-dev%2Fviagen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31291119,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude-code","github","vercel","vite"],"created_at":"2026-02-18T05:13:41.863Z","updated_at":"2026-04-01T19:19:38.019Z","avatar_url":"https://github.com/viagen-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# viagen\n\nA Vite dev server plugin and CLI tool that enables you to use Claude Code in a sandbox — instantly.\n\n## Prerequisites\n\n- [Claude](https://claude.ai/signup) — Max, Pro, or API plan. The setup wizard handles auth.\n- [Vercel](https://vercel.com/signup) — Free plan works. Sandboxes last 45 min on Hobby, 5 hours on Pro.\n- [GitHub CLI](https://cli.github.com) — Enables git clone and push from sandboxes.\n\n## Quick Setup (Claude Code Plugin)\n\n```\n/plugin marketplace add viagen-dev/viagen-claude-plugin\n/plugin install viagen@viagen-marketplace\n```\n\n**Restart Claude Code to load the plugin.**\n\n```\n/viagen-install\n```\n\nThe plugin will handle npm installation, vite config updates, and run the setup wizard for you.\n\n## Manual Setup\n\n### Step 1 — Add viagen to your app\n\n```bash\nnpm install --save-dev viagen\n```\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { viagen } from 'viagen'\n\nexport default defineConfig({\n  plugins: [viagen()],\n})\n```\n\n### Step 2 — Setup\n\n```bash\nnpx viagen setup\n```\n\nThe setup wizard authenticates with Claude, detects your GitHub and Vercel credentials, and captures your git remote info — all written to your local `.env`. This ensures sandboxes clone the correct repo instead of inferring it at runtime.\n\nYou can now run `npm run dev` to start the local dev server. At this point you can launch viagen and chat with Claude to make changes to your app.\n\n### Step 3 — Sandbox\n\n```bash\nnpx viagen sandbox\n```\n\nDeploys your dev server to a remote Vercel Sandbox — an isolated VM-like environment where Claude can read, write, and push code.\n\n```bash\n# Deploy on a specific branch\nnpx viagen sandbox --branch feature/my-thing\n\n# Set a longer timeout (default: 30 min)\nnpx viagen sandbox --timeout 60\n\n# Auto-send a prompt on load\nnpx viagen sandbox --prompt \"build me a landing page\"\n\n# Stop a running sandbox\nnpx viagen sandbox stop \u003csandboxId\u003e\n```\n\n\n## Plugin Options\n\n```ts\nviagen({\n  position: 'bottom-right',  // toggle button position\n  model: 'sonnet',           // claude model\n  panelWidth: 375,           // chat panel width in px\n  overlay: true,             // fix button on error overlay\n  ui: true,                  // inject chat panel into pages\n  sandboxFiles: [...],       // copy files manually into sandbox\n  systemPrompt: '...',       // custom system prompt (see below)\n  editable: ['src','conf'],  // files/dirs editable in the UI\n  mcpServers: { ... },       // additional MCP servers for Claude\n})\n```\n\n\n### Custom MCP Servers\n\nPass additional [MCP server](https://modelcontextprotocol.io) configurations to give Claude access to custom tools:\n\n```ts\nviagen({\n  mcpServers: {\n    'my-db': {\n      command: 'npx',\n      args: ['-y', '@my-org/db-mcp-server'],\n      env: { DATABASE_URL: process.env.DATABASE_URL },\n    },\n  },\n})\n```\n\nThese are merged with viagen's built-in platform tools (when connected). User-provided servers take precedence if names collide.\n\n### Editable Files\n\nAdd a file editor panel to the chat UI:\n\n```ts\nviagen({\n  editable: ['src/components', 'vite.config.ts']\n})\n```\n\nPaths can be files or directories (directories include all files within). The editor appears as a \"Files\" tab in the chat panel with a collapsible directory tree, syntax highlighting (TypeScript, JavaScript, CSS, HTML, JSON, Markdown), and image preview.\n\nThe default system prompt tells Claude it's embedded in a Vite dev server, that file edits trigger HMR, and how to check server logs. Recent build errors are automatically appended to give Claude context about what went wrong.\n\nTo customize the prompt, you can replace it entirely or extend the default:\n\n```ts\nimport { viagen, DEFAULT_SYSTEM_PROMPT } from 'viagen'\n\nviagen({\n  // Replace entirely\n  systemPrompt: 'You are a React expert. Only use TypeScript.',\n\n  // Or extend the default\n  systemPrompt: DEFAULT_SYSTEM_PROMPT + '\\nAlways use Tailwind for styling.',\n})\n```\n\n## API\n\nEvery viagen endpoint is available as an API. Build your own UI, integrate with CI, or script Claude from the command line.\n\n```\nPOST /via/chat        — send a message, streamed SSE response\nPOST /via/chat/reset  — clear conversation history\nGET  /via/health      — check API key status\nGET  /via/error       — latest build error (if any)\nGET  /via/ui          — standalone chat interface\nGET  /via/iframe      — split view (app + chat side by side)\nGET  /via/files       — list editable files (when configured)\nGET  /via/file?path=  — read file content\nPOST /via/file        — write file content { path, content }\nGET  /via/file/raw    — serve raw file (images, etc.) with correct MIME type\nGET  /via/git/status  — list changed files (git status)\nGET  /via/git/diff    — full diff, or single file with ?path=\nGET  /via/git/branch  — current branch, remote URL, open PR info\nGET  /via/logs        — dev server log entries, optional ?since=\u003ctimestamp\u003e\n```\n\nWhen `VIAGEN_AUTH_TOKEN` is set (always on in sandboxes), pass the token as a `Bearer` header, a `/t/:token` path segment, or a `?token=` query param.\n\n```bash\n# With curl\ncurl -X POST http://localhost:5173/via/chat \\\n  -H \"Authorization: Bearer $VIAGEN_AUTH_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"message\": \"add a hello world route\"}'\n\n# Or pass the token in the URL path (sets a session cookie)\nopen \"http://localhost:5173/via/ui/t/$VIAGEN_AUTH_TOKEN\"\n\n# ?token= query param also works (fallback for backwards compat)\nopen \"http://localhost:5173/via/ui?token=$VIAGEN_AUTH_TOKEN\"\n```\n\n## Development\n\n```bash\nnpm install\nnpm run dev        # Dev server (site)\nnpm run build      # Build with tsup\nnpm run test       # Run tests\nnpm run typecheck  # Type check\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviagen-dev%2Fviagen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviagen-dev%2Fviagen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviagen-dev%2Fviagen/lists"}