Big Marge client and registry config
Generated client
Section titled “Generated client”big-marge-client writes a fetch-based helper:
export interface BigMargeClientOptions { baseUrl: string; fetch?: typeof fetch;}
export function createBigMargeClient(options: BigMargeClientOptions) { const request = options.fetch ?? fetch;
return { async message(message: string): Promise<{ reply: string }> { const response = await request(new URL('/message', options.baseUrl), { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ message }), });
if (!response.ok) { throw new Error(`Big Marge request failed: ${response.status}`); }
return (await response.json()) as { reply: string }; }, };}Use it from browser or service code:
const marge = createBigMargeClient({ baseUrl: 'https://api.example.com/big-marge',});
const { reply } = await marge.message('Are you listening?');Pass a custom fetch implementation for tests, tracing, or server-side authentication.
Monorepo registry config
Section titled “Monorepo registry config”Map runtime and client items to separate projects:
{ "$schema": "https://workers-registry.dev/schema/cli-config.json", "registryUrl": "https://registry.example.com", "packageManager": { "command": "pnpm", "installArgs": ["install"], "cwd": "." }, "defaultProject": "worker", "projects": { "worker": { "path": "./apps/api", "packageJson": "package.json", "wrangler": "wrangler.jsonc" }, "client": { "path": "./apps/web", "packageJson": "package.json", "wrangler": null } }, "targetsByKind": { "runtime": "worker", "client": "client", "bundle": "worker" }}When adding big-marge-full, the bundle resolves both registry dependencies. Each child item still follows its own kind-to-project mapping, so the runtime lands in the Worker and the client lands in the web app.
Registry commands
Section titled “Registry commands”workers-registry listworkers-registry get big-marge-clientworkers-registry get big-marge-client@0.1.0workers-registry add big-marge-client@0.1.0Published versions are immutable. Pin a version in automation so a later registry release cannot change generated source unexpectedly.