Upgrade to Pro — share decks privately, control downloads, hide ads and more …

test

Avatar for thirdlf03 thirdlf03
July 05, 2026
13

 test

Avatar for thirdlf03

thirdlf03

July 05, 2026

More Decks by thirdlf03

Transcript

  1. 3層のアーキテクチャ • Client SDK: 型安全なTypeScript API • Durable Object: ライフサイクル管理

    とルーティングの調整レイヤー • Container Runtime: VM-based isolationで実行
  2. wrangler.jsoncの設定例 { "containers": [ { "class_name": "Sandbox", "image": "./Dockerfile", "instance_type":

    "lite", "max_instances": 1 } ], "durable_objects": { "bindings": [{ "class_name": "Sandbox", "name": "Sandbox" }] }, "migrations": [{ "new_sqlite_classes": ["Sandbox"], "tag": "v1" }] }
  3. 最小のコード例 import { getSandbox, type Sandbox } from "@cloudflare/sandbox"; export

    default { async fetch(request: Request, env: Env) { const sandbox = getSandbox(env.Sandbox, "my-sandbox"); const result = await sandbox.exec('python3 -c "print(2 + 2)"'); return Response.json({ output: result.stdout, error: result.stderr }); }, };
  4. ファイル操作の主なAPI • writeFile() / readFile() • exists() / mkdir() •

    deleteFile() / renameFile() / moveFile() • gitCheckout()