Type-safe RPC calls from TanStack Start to Cloudflare Workers via service bindings
All methods are defined in packages/worker/src/rpc.tsx
Returns a greeting message with timestamp
sayHello(name: string): Promise<{ message: string; timestamp: number }>/rpc/say-hello?name=WorldPerforms arithmetic operations (add, subtract, multiply, divide)
calculate(operation: string, a: number, b: number): Promise<number>/rpc/calculate?operation=add&a=10&b=20Fetches data by key (mock implementation, can be connected to KV, D1, R2, etc.)
getData(key: string): Promise<{ key: string; found: boolean; value?: string }>/rpc/get-data?key=myKeyProcesses batch operations on array of items
processBatch(items: string[]): Promise<{ processed: number; items: string[] }>/rpc/process-batchReturns JSX with server-side fetched data (external APIs, env vars) - browser never sees these requests!
getComponent(): Promise<SerializableNode>/rpc/get-componentWorkerRpc class in packages/worker/src/rpc.tsxpackages/web/env.d.tspackages/web/src/routes/rpc/ to call your methodgetWorkerRpc() helper to access the typed RPC binding