Expand description
CLI tool for the vercel-rpc project.
Scans Rust lambda source files for #[rpc_query] / #[rpc_mutation]
functions and #[derive(Serialize)] types, then generates TypeScript type
definitions and a fully typed RPC client.
§Binary
The installed binary is called rpc and provides three subcommands:
rpc scan— parse a directory and print discovered procedures as human-readable text plus a JSON manifest.rpc generate— producerpc-types.ts(interfaces +Procedurestype) andrpc-client.ts(typedRpcClient+createRpcClientfactory).rpc watch— same asgenerate, but re-runs automatically whenever a.rsfile changes (configurable debounce).
§Architecture
┌─────────────┐ scan ┌──────────┐ codegen ┌────────────────┐
│ api/*.rs │ ──────► │ Manifest │ ────────► │ rpc-types.ts │
│ attributes │ (syn) │ │ (fmt) │ rpc-client.ts │
└─────────────┘ └──────────┘ └────────────────┘parser— walks the source directory, parses each.rsfile withsyn, and builds amodel::Manifest.codegen::typescript— converts the manifest into arpc-types.tsfile with TypeScript interfaces, enum types, and aProceduresmap.codegen::client— converts the manifest into arpc-client.tsfile with a typedRpcClientinterface andcreateRpcClientfactory.watch— wrapsgeneratein a file-watcher loop with debouncing.