[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-855":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":15,"starSnapshotCount":15,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},855,"serve-sim","EvanBacon\u002Fserve-sim","EvanBacon","The `npx serve` of Apple Simulators.",null,"TypeScript",1659,74,7,9,0,107,403,711,321,18.63,false,"main",[],"2026-06-12 02:00:19","# serve-sim\n\nThe `npx serve` of Apple Simulators. \n\nHost your simulator for use with Agent tools like Codex, Cursor, or Claude Desktop — locally, over your LAN, or host on a remote mac and tunnel anywhere. \n\n```sh\nnpx serve-sim\n# → Preview at http:\u002F\u002Flocalhost:3200\n```\n\nhttps:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Ffbf890f4-c8c7-4684-82be-d677b8a188f8\n\n`serve-sim` spawns a small Swift helper that captures the simulator's framebuffer via `simctl io`, exposes it as an MJPEG stream + WebSocket control channel, and serves a React preview UI on top. It works with any booted iOS Simulator — no Xcode plugin, no instrumentation in your app.\n\n## Features \n\n- Full 60 FPS video stream in the browser.\n- Swipe from the bottom to go home.\n- gestures like pinch to zoom by holding the option key.\n- Simulator logs are forwarded to the browser for browser-use MCP tools to read from.\n- Drag and drop videos and images to add them to the simulator device. \n- Keyboard commands and hot keys are forwarded to the simulator, including CMD+SHIFT+H to go home.\n- Apple Watch, iPad, and iOS support.\n\n## Why?\n\nHosted simulators can be hard to test, `serve-sim` enables you to test the hosted infra locally first for faster iteration. When you're ready to host a simulator remotely, simply tunnel the served URL and users can interact with the simulator as if it were running locally on their device.\n\nI develop the Expo framework, but this tool is completely agnostic to React Native and can be used for any iOS interaction you need.\n\n## Install\n\nRequires macOS with Xcode command line tools (`xcrun simctl`) and Node.js 18+. `bun` is **not** required to run the CLI.\n\n## CLI\n\n```\nserve-sim [device...]                 Start preview server (default: localhost:3200)\nserve-sim --no-preview [device...]    Stream in foreground without a preview server\nserve-sim gesture '\u003Cjson>' [-d udid]  Send a touch gesture\nserve-sim button [name] [-d udid]     Send a button press (default: home)\nserve-sim rotate \u003Corientation> [-d udid]\n                                      portrait | portrait_upside_down |\n                                      landscape_left | landscape_right\nserve-sim ca-debug \u003Coption> \u003Con|off> [-d udid]\n                                      Toggle a CoreAnimation debug flag\n                                      (blended|copies|misaligned|offscreen|slow-animations)\nserve-sim memory-warning [-d udid]    Simulate a memory warning\n\nOptions:\n  -p, --port \u003Cport>   Starting port (preview default: 3200, stream default: 3100)\n  -d, --detach        Spawn helper and exit (daemon mode)\n  -q, --quiet         JSON-only output\n      --no-preview    Skip the web UI; stream in foreground only\n      --list [device] List running streams\n      --kill [device] Kill running stream(s)\n```\n\n### Examples\n\n```sh\nserve-sim                              # auto-detect booted sim, open preview\nserve-sim \"iPhone 16 Pro\"              # target a specific device\nserve-sim --detach                     # start a background helper, return JSON\nserve-sim --list                       # show running streams\nserve-sim --kill                       # stop all helpers\n```\n\nMultiple booted simulators are supported — pass several device names, or leave it empty to attach to all of them.\n\n## Connectors\n\n`serve-sim` can be used with dev servers, browser, and AI editors for more seamless integration.\n\n### Claude Code Desktop\n\nCreate a `.claude\u002Flaunch.json` and define a server:\n\n```json\n{\n  \"version\": \"0.0.1\",\n  \"configurations\": [\n    {\n      \"name\": \"ios\",\n      \"runtimeExecutable\": \"npx\",\n      \"runtimeArgs\": [\"serve-sim\"],\n      \"port\": 3200,\n    }\n  ]\n}\n```\n\n### Expo\n\nAutomatically start the serve-sim process with `npx expo start` and access the URL at `http:\u002F\u002Flocalhost:8081\u002F.sim`.\n\nFirst, customize the `metro.config.js` file (`bunx expo customize`):\n\n```js\n\u002F\u002F Learn more https:\u002F\u002Fdocs.expo.io\u002Fguides\u002Fcustomizing-metro\nconst { getDefaultConfig } = require(\"expo\u002Fmetro-config\");\nconst connect = require(\"connect\");\nconst { simMiddleware } = require(\"serve-sim\u002Fmiddleware\");\n\n\u002F** @type {import('expo\u002Fmetro-config').MetroConfig} *\u002F\nconst config = getDefaultConfig(__dirname);\n\nconfig.server = config.server || {};\nconst originalEnhanceMiddleware = config.server.enhanceMiddleware;\nconfig.server.enhanceMiddleware = (metroMiddleware, server) => {\n  const middleware = originalEnhanceMiddleware\n    ? originalEnhanceMiddleware(metroMiddleware, server)\n    : metroMiddleware;\n  const app = connect();\n  app.use(simMiddleware({ basePath: \"\u002F.sim\" }));\n  app.use(middleware);\n  return app;\n};\n\nmodule.exports = config;\n```\n\n## Embed in your dev server\n\n`serve-sim\u002Fmiddleware` is a Connect-style middleware that mounts the same preview UI inside your existing dev server (Metro, Vite, Next, plain Express, etc.). Run `serve-sim --detach` once to start the streaming helper, then add the middleware:\n\n```ts\nimport { simMiddleware } from \"serve-sim\u002Fmiddleware\";\n\napp.use(simMiddleware({ basePath: \"\u002F.sim\" }));\n\u002F\u002F → preview HTML at \u002F.sim\n\u002F\u002F → state JSON  at \u002F.sim\u002Fapi\n\u002F\u002F → SSE logs    at \u002F.sim\u002Flogs\n```\n\nThe middleware reads the helper's state from `$TMPDIR\u002Fserve-sim\u002F` and forwards the user's browser to the live MJPEG + WebSocket endpoints. CORS is wide-open on the helper, so the page renders without a proxy.\n\n## How it works\n\n```\n┌──────────────┐   simctl io   ┌─────────────────┐  MJPEG \u002F WS  ┌─────────┐\n│ iOS Simulator│ ────────────► │ serve-sim-bin   │ ───────────► │ Browser │\n└──────────────┘   (Swift)     │ (per-device)    │              └─────────┘\n                               └─────────────────┘\n                                       ▲\n                                  state file in\n                                $TMPDIR\u002Fserve-sim\u002F\n                                       ▲\n                               ┌──────────────────┐\n                               │ serve-sim CLI \u002F  │\n                               │ middleware       │\n                               └──────────────────┘\n```\n\nThe Swift helper (`bin\u002Fserve-sim-bin`) is a tiny standalone binary — no Xcode dependency at runtime. The CLI embeds it via `bun build --compile`, so installing the npm package is enough.\n\n## Development\n\n```sh\nbun install\nbun run --filter serve-sim build         # build the JS bundles\nbun run --filter serve-sim build:swift   # rebuild the Swift helper\nbun run --filter serve-sim dev           # watch mode\n```\n\n## License\n\nApache-2.0\n","`serve-sim`是一个用于Apple模拟器的托管工具，通过简单的命令行操作即可在本地、局域网或远程Mac上托管并访问iOS模拟器。项目使用TypeScript编写，支持全60帧视频流浏览器预览、手势控制（如捏合缩放）、拖放文件到模拟器等功能，并且可以转发模拟器日志和键盘命令至浏览器。该工具非常适合需要快速迭代测试托管基础设施的场景，无论是本地开发还是远程协作都能提供流畅的体验。无需Xcode插件或应用内嵌入代码，对React Native框架无依赖性，适用于任何iOS交互需求。",2,"2026-06-11 02:39:50","CREATED_QUERY"]