run_code
Execute arbitrary JavaScript in the Hatchable isolate runtime to test database queries, auth, storage, or API calls without deploying. Returns result instantly.
Instructions
Execute arbitrary JS in the project's isolate runtime with the same bindings a deployed function gets: db, auth, email, storage from "hatchable", plus process.env and global fetch. The return value of the snippet becomes the result field.
Use this as a REPL: probe the database, verify a computation, test an API shape before committing it to a file. Nothing is persisted — the snippet runs once and disappears.
Caps: 5s default timeout (max 30s), 256 KB max source length.
Example:
run_code({ project_id, code: const { db } = await import("hatchable");
const { rows } = await db.query("SELECT count(*) FROM users");
return rows[0];
})
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Project ID | |
| code | Yes | JS snippet. Use `return` to produce a result. | |
| timeout_ms | No | Execution timeout in ms (default 5000, max 30000) |